Class: Igniter::Contracts::Assembly::DslKeyword
- Inherits:
-
Object
- Object
- Igniter::Contracts::Assembly::DslKeyword
- Defined in:
- lib/igniter/contracts/assembly/dsl_keyword.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #call(*args, builder:, **kwargs, &block) ⇒ Object
-
#initialize(name, callable = nil, &block) ⇒ DslKeyword
constructor
A new instance of DslKeyword.
Constructor Details
#initialize(name, callable = nil, &block) ⇒ DslKeyword
Returns a new instance of DslKeyword.
9 10 11 12 13 |
# File 'lib/igniter/contracts/assembly/dsl_keyword.rb', line 9 def initialize(name, callable = nil, &block) @name = name.to_sym @callable = callable || block raise ArgumentError, "keyword #{@name} requires a callable" unless @callable end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/igniter/contracts/assembly/dsl_keyword.rb', line 7 def name @name end |
Instance Method Details
#call(*args, builder:, **kwargs, &block) ⇒ Object
15 16 17 |
# File 'lib/igniter/contracts/assembly/dsl_keyword.rb', line 15 def call(*args, builder:, **kwargs, &block) @callable.call(*args, builder:, **kwargs, &block) end |