class Shoutout::Metadata
Public Class Methods
new(constructor = {})
click to toggle source
Calls superclass method
# File lib/shoutout/metadata.rb, line 13 def initialize(constructor = {}) if constructor.is_a?(Hash) super() update(constructor) else super(constructor) end end
parse(raw_metadata)
click to toggle source
# File lib/shoutout/metadata.rb, line 3 def self.parse(raw_metadata) metadata = {} raw_metadata.split(";").each do |key_value_pair| key, value = key_value_pair.split("=", 2) metadata[key] = value.match(/\A'(.*)'\z/)[1] end new(metadata) end
Public Instance Methods
[](key)
click to toggle source
Calls superclass method
# File lib/shoutout/metadata.rb, line 22 def [](key) super(convert_key(key)) end
[]=(key, value)
click to toggle source
Calls superclass method
# File lib/shoutout/metadata.rb, line 26 def []=(key, value) super(convert_key(key), value) end
Also aliased as: store
delete(key)
click to toggle source
Calls superclass method
# File lib/shoutout/metadata.rb, line 40 def delete(key) super(convert_key(key)) end
key?(key)
click to toggle source
Calls superclass method
# File lib/shoutout/metadata.rb, line 32 def key?(key) super(convert_key(key)) end
Private Instance Methods
convert_key(key)
click to toggle source
# File lib/shoutout/metadata.rb, line 70 def convert_key(key) key.kind_of?(Symbol) ? Util.camelize(key.to_s) : key end