Class: Interscript::DSL::Aliases
- Inherits:
-
Object
- Object
- Interscript::DSL::Aliases
- Includes:
- Items
- Defined in:
- lib/interscript/dsl/aliases.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
Returns the value of attribute node.
Instance Method Summary collapse
- #def_alias(name, value) ⇒ Object
-
#initialize(&block) ⇒ Aliases
constructor
A new instance of Aliases.
Methods included from Items
#any, #capture, #map, #maybe, #maybe_some, #method_missing, #ref, #some, #stage
Methods included from SymbolMM
Constructor Details
#initialize(&block) ⇒ Aliases
Returns a new instance of Aliases.
6 7 8 9 |
# File 'lib/interscript/dsl/aliases.rb', line 6 def initialize(&block) @node = {} self.instance_exec(&block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Interscript::DSL::Items
Instance Attribute Details
#node ⇒ Object
Returns the value of attribute node.
4 5 6 |
# File 'lib/interscript/dsl/aliases.rb', line 4 def node @node end |
Instance Method Details
#def_alias(name, value) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/interscript/dsl/aliases.rb', line 11 def def_alias(name, value) if Interscript::Node::Item::Alias === name name = name.name end unless Symbol === name raise Interscript::SystemConversionError, "Alias name must be a Symbol, given #{name.class}" end puts "def_alias(#{name.inspect}, #{thing.inspect})" if $DEBUG @node[name] = Interscript::Node::AliasDef.new(name, value) end |