Class: EdifactConverter::Configuration::YAMLConfigurator
- Inherits:
-
Object
- Object
- EdifactConverter::Configuration::YAMLConfigurator
- Defined in:
- lib/edifact_converter/configuration/yaml_configurator.rb
Instance Attribute Summary collapse
-
#binary_versions ⇒ Object
Returns the value of attribute binary_versions.
-
#default_ns ⇒ Object
Returns the value of attribute default_ns.
Instance Method Summary collapse
- #binary?(version) ⇒ Boolean
- #edifact_rules(type, segment_group) ⇒ Object
-
#initialize ⇒ YAMLConfigurator
constructor
A new instance of YAMLConfigurator.
-
#xml_rules(*args) ⇒ Object
Either namespace or type and version.
Constructor Details
#initialize ⇒ YAMLConfigurator
Returns a new instance of YAMLConfigurator.
10 11 12 |
# File 'lib/edifact_converter/configuration/yaml_configurator.rb', line 10 def initialize load end |
Instance Attribute Details
#binary_versions ⇒ Object
Returns the value of attribute binary_versions.
8 9 10 |
# File 'lib/edifact_converter/configuration/yaml_configurator.rb', line 8 def binary_versions @binary_versions end |
#default_ns ⇒ Object
Returns the value of attribute default_ns.
8 9 10 |
# File 'lib/edifact_converter/configuration/yaml_configurator.rb', line 8 def default_ns @default_ns end |
Instance Method Details
#binary?(version) ⇒ Boolean
33 34 35 |
# File 'lib/edifact_converter/configuration/yaml_configurator.rb', line 33 def binary?(version) binary_versions.include? version end |
#edifact_rules(type, segment_group) ⇒ Object
14 15 16 |
# File 'lib/edifact_converter/configuration/yaml_configurator.rb', line 14 def edifact_rules(type, segment_group) edifact_settings[type][segment_group] end |
#xml_rules(*args) ⇒ Object
Either namespace or type and version
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/edifact_converter/configuration/yaml_configurator.rb', line 18 def xml_rules(*args) #Either namespace or type and version case args.size when 1 xml_settings[args.first] when 2 rules = xml_settings.find do |namespace, values| values.versions && values.versions.include?(args[1]) end rules &&= rules.last rules || xml_settings[default_ns] else raise RuntimeError "Wrong number of arguments #{args.size}" end end |