Class: Eancom::Factory
- Inherits:
-
Object
- Object
- Eancom::Factory
- Defined in:
- lib/eancom/factory.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#document ⇒ Object
readonly
Returns the value of attribute document.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(json:) ⇒ Factory
constructor
A new instance of Factory.
Constructor Details
#initialize(json:) ⇒ Factory
Returns a new instance of Factory.
8 9 10 11 |
# File 'lib/eancom/factory.rb', line 8 def initialize(json:) @config = JSON.parse(json, object_class: OpenStruct) @document = Eancom::Edifact::Document.new end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/eancom/factory.rb', line 6 def config @config end |
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
6 7 8 |
# File 'lib/eancom/factory.rb', line 6 def definition @definition end |
#document ⇒ Object (readonly)
Returns the value of attribute document.
6 7 8 |
# File 'lib/eancom/factory.rb', line 6 def document @document end |
Instance Method Details
#build ⇒ Object
13 14 15 16 17 |
# File 'lib/eancom/factory.rb', line 13 def build @definition = Eancom.find_definition(name: name, type: type) @definition.run(document: document, config: config) @document end |