Module: Origami::XFA::ClassMethods
- Defined in:
- lib/origami/xfa.rb
Instance Method Summary collapse
- #mime_type(type) ⇒ Object
- #xfa_attribute(name) ⇒ Object
- #xfa_node(name, type, range = (0..(1.0/0))) ⇒ Object
Instance Method Details
#mime_type(type) ⇒ Object
74 75 76 |
# File 'lib/origami/xfa.rb', line 74 def mime_type(type) send(:define_method, "mime_type") { return type } end |
#xfa_attribute(name) ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/origami/xfa.rb', line 48 def xfa_attribute(name) read_xml_attr = lambda { return self.attributes[name.to_s] } write_xml_attr = lambda { |value| self.attributes[name.to_s] = value } send(:define_method, "attr_#{name.to_s}", read_xml_attr) send(:define_method, "attr_#{name.to_s}=", write_xml_attr) end |
#xfa_node(name, type, range = (0..(1.0/0))) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/origami/xfa.rb', line 58 def xfa_node(name, type, range = (0..(1.0/0))) add_child = lambda { |*attr| elt = self.add_element(type.new) unless attr.empty? attr.first.each do |k,v| elt.attributes[k.to_s] = v end end return elt } send(:define_method, "add_#{name}", add_child) end |