Class: XmlToForm::XmlHandler
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- XmlToForm::XmlHandler
show all
- Extended by:
- ActiveModel::Callbacks, NokoHacks
- Includes:
- ActiveModel::Model
- Defined in:
- app/models/xml_to_form/xml_handler.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from NokoHacks
build_ds, child_node_ds, decode_node_path, encode_node_path, get_node_attribute_name, iterate_child_nodes, remove_blank_node, update_xml, update_xml_attributes
Class Method Details
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/models/xml_to_form/xml_handler.rb', line 14
def self.noko_meta_data(file)
xml_obj = Nokogiri::XML(file).remove_namespaces! do |config|
config.default_xml.noblanks
end
xml_obj.children.remove_blank_node
xml_obj.children.iterate_child_nodes(_node_array= [], attr_accessor_hash ={})
attr_accessor_hash.each do |attr_key, attr_value|
attr_accessor attr_key.to_sym
end
return _node_array, attr_accessor_hash, xml_obj
end
|
Instance Method Details
#after_initialize(some_hash) ⇒ Object
8
9
10
11
12
|
# File 'app/models/xml_to_form/xml_handler.rb', line 8
def after_initialize(some_hash)
some_hash.each do |key, value|
self.send("#{key}=", value) rescue nil
end if some_hash.is_a?(Hash)
end
|