Class: Beni::DSL::TargetContext
- Inherits:
-
Object
- Object
- Beni::DSL::TargetContext
- Defined in:
- lib/beni/dsl/target_context.rb
Overview
Vocabulary inside a target <name> do … end block — block-less toolchain references only. References are set-semantic: repeats collapse, and referencing mruby is legal redundancy.
Instance Attribute Summary collapse
-
#references ⇒ Object
readonly
Returns the value of attribute references.
Class Method Summary collapse
-
.collect ⇒ Object
Run
blockon a fresh context and return the collected reference names.
Instance Method Summary collapse
-
#initialize ⇒ TargetContext
constructor
A new instance of TargetContext.
- #toolchain(name, &block) ⇒ Object
Constructor Details
#initialize ⇒ TargetContext
Returns a new instance of TargetContext.
19 20 21 |
# File 'lib/beni/dsl/target_context.rb', line 19 def initialize @references = [] end |
Instance Attribute Details
#references ⇒ Object (readonly)
Returns the value of attribute references.
17 18 19 |
# File 'lib/beni/dsl/target_context.rb', line 17 def references @references end |
Class Method Details
.collect ⇒ Object
Run block on a fresh context and return the collected reference names.
11 12 13 14 15 |
# File 'lib/beni/dsl/target_context.rb', line 11 def self.collect(&) context = new context.instance_exec(&) context.references end |
Instance Method Details
#toolchain(name, &block) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/beni/dsl/target_context.rb', line 23 def toolchain(name, &block) if block raise Error, "`toolchain #{name.inspect}` inside a target block must not carry a block — " \ "definitions live at the top level" end DSL.assert_known_toolchain!(name) @references << name unless @references.include?(name) end |