Class: EdifactConverter::Configuration::XMLRule
- Inherits:
-
Object
- Object
- EdifactConverter::Configuration::XMLRule
- Defined in:
- lib/edifact_converter/configuration/xml_rule.rb
Constant Summary collapse
- ATTRIBUTES =
[ :namespace, :versions, :schema, :schema_urls, :from_xml, :from_xml_urls, :to_xml, :to_xml_urls, :to_html, :to_html_urls ]
Instance Method Summary collapse
- #from_xml ⇒ Object
-
#initialize(options) ⇒ XMLRule
constructor
A new instance of XMLRule.
- #schema ⇒ Object
- #to_html ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize(options) ⇒ XMLRule
Returns a new instance of XMLRule.
22 23 24 25 26 27 28 |
# File 'lib/edifact_converter/configuration/xml_rule.rb', line 22 def initialize() .each do |name, value| if ATTRIBUTES.include? name.to_sym send "#{name}=", value end end end |
Instance Method Details
#from_xml ⇒ Object
37 38 39 40 41 42 |
# File 'lib/edifact_converter/configuration/xml_rule.rb', line 37 def from_xml @from_xml ||= begin xmldoc = load_doc_from_urls from_xml_urls Nokogiri::XSLT::Stylesheet.parse_stylesheet_doc xmldoc end end |
#schema ⇒ Object
30 31 32 33 34 35 |
# File 'lib/edifact_converter/configuration/xml_rule.rb', line 30 def schema @schema ||= begin xmldoc = load_doc_from_urls schema_urls Nokogiri::XML::Schema.from_document xmldoc end end |
#to_html ⇒ Object
51 52 53 54 55 56 |
# File 'lib/edifact_converter/configuration/xml_rule.rb', line 51 def to_html @to_html ||= begin xmldoc = load_doc_from_urls to_html_urls Nokogiri::XSLT::Stylesheet.parse_stylesheet_doc xmldoc end end |
#to_xml ⇒ Object
44 45 46 47 48 49 |
# File 'lib/edifact_converter/configuration/xml_rule.rb', line 44 def to_xml @to_xml ||= begin xmldoc = load_doc_from_urls to_xml_urls Nokogiri::XSLT::Stylesheet.parse_stylesheet_doc xmldoc end end |