Module: EPUB::Publication::Package::ContentModel

Included in:
Bindings, Manifest, Metadata, Spine
Defined in:
lib/epub/maker/publication.rb

Instance Method Summary collapse

Instance Method Details

#to_xml_attribute(node, model, attributes) ⇒ Object

Parameters:

  • node (Nokogiri::XML::Builder::NodeBuilder)
  • model (Object)
  • attributes (Array<Symbol|String>)

    names of attribute.



91
92
93
94
95
96
# File 'lib/epub/maker/publication.rb', line 91

def to_xml_attribute(node, model, attributes)
  attributes.each do |attr|
    val = model.__send__(attr)
    node[attr.to_s.gsub('_', '-')] = val if val
  end
end