Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions lib/mediainfo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,13 @@ def self.from_uri(input)

def self.set_singleton_method(object,name,parameters)
# Handle parameters with invalid characters (instance_variable_set throws error)
name.gsub!('.','_') if name.include?('.') ## period in name
name.downcase!
method_name = name.gsub('.', '_').gsub('-', '_').downcase

# Create singleton_method
object.instance_variable_set("@#{name}",parameters)
object.define_singleton_method name do
object.instance_variable_get "@#{name}"
object.instance_variable_set("@#{method_name}",parameters)
object.define_singleton_method method_name do
object.instance_variable_get "@#{method_name}"
object.instance_variable_get "@#{method_name}"
end
end

Expand Down