Class: Eancom::Definition
- Inherits:
-
Object
- Object
- Eancom::Definition
- Defined in:
- lib/eancom/definition.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, type:, &block) ⇒ Definition
constructor
A new instance of Definition.
- #run(document:, config:) ⇒ Object
Constructor Details
#initialize(name:, type:, &block) ⇒ Definition
Returns a new instance of Definition.
11 12 13 14 15 |
# File 'lib/eancom/definition.rb', line 11 def initialize(name:, type:, &block) @name = name @type = type @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
4 5 6 |
# File 'lib/eancom/definition.rb', line 4 def block @block end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/eancom/definition.rb', line 4 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/eancom/definition.rb', line 4 def type @type end |
Class Method Details
.create(name:, type:, &block) ⇒ Object
6 7 8 9 |
# File 'lib/eancom/definition.rb', line 6 def self.create(name:, type:, &block) definition = new(name: name, type: type, &block) Eancom.register_definition(definition) end |
Instance Method Details
#run(document:, config:) ⇒ Object
17 18 19 |
# File 'lib/eancom/definition.rb', line 17 def run(document:, config:) @block.call(document, config) end |