module ONIX::Attributes
Attributes
attributes[RW]
@return [Hash<String,Code>]
Public Class Methods
attribute_class(attr)
click to toggle source
@param [String] attr @return [Class]
# File lib/onix/subset.rb, line 45 def self.attribute_class(attr) case attr when "textcase" TextCase when "textformat" TextFormat when "language" LanguageCode when "dateformat" DateFormat when "datestamp" DateStamp else nil end end
Public Instance Methods
parse_attributes(attrs)
click to toggle source
# File lib/onix/subset.rb, line 62 def parse_attributes(attrs) @attributes ||= {} attrs.each do |k, v| attr_klass = Attributes.attribute_class(k.to_s) @attributes[k.to_s] = attr_klass ? attr_klass.from_code(v.to_s) : nil end end
serialized_attributes()
click to toggle source
@return [Hash<String,String>]
# File lib/onix/subset.rb, line 33 def serialized_attributes if @attributes and @attributes.length > 0 attrs = {} @attributes.each do |k, v| attrs[k] = v.code if v end attrs end end