Class: DSL::Var
- Inherits:
- 
      Object
      
        - Object
- DSL::Var
 
- Defined in:
- tools/dsl.rb
Defined Under Namespace
Classes: Table
Constant Summary collapse
- PRETTY_PRINT_INSTANCE_VARIABLES =
- instance_methods(false).freeze 
Instance Attribute Summary collapse
- 
  
    
      #value  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute value. 
- 
  
    
      #var  ⇒ Object 
    
    
      (also: #to_s)
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute var. 
Instance Method Summary collapse
- 
  
    
      #[](idx)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Indexing. 
- 
  
    
      #initialize(table, arg, &block)  ⇒ Var 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Var. 
- #pretty_print_instance_variables ⇒ Object
Constructor Details
#initialize(table, arg, &block) ⇒ Var
Returns a new instance of Var.
| 85 86 87 88 89 | # File 'tools/dsl.rb', line 85 def initialize(table, arg, &block) @var = table.new_var @value = yield arg @table = table end | 
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
| 75 76 77 | # File 'tools/dsl.rb', line 75 def value @value end | 
#var ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute var.
| 75 76 77 | # File 'tools/dsl.rb', line 75 def var @var end | 
Instance Method Details
#[](idx) ⇒ Object
Indexing.
$:1 -> v1=get_value($:1)
$:1[0] -> rb_ary_entry(v1, 0)
$:1[0..1] -> [rb_ary_entry(v1, 0), rb_ary_entry(v1, 1)]
*$:1[0..1] -> rb_ary_entry(v1, 0), rb_ary_entry(v1, 1)
Splat needs ‘[range]` because `Var` does not have the length info.
| 99 100 101 102 103 104 105 | # File 'tools/dsl.rb', line 99 def [](idx) if ::Range === idx idx.map {|i| self[i]} else @table.fetch("#@var[#{idx}]") {"rb_ary_entry(#{@var}, #{idx})"} end end | 
#pretty_print_instance_variables ⇒ Object
| 79 80 81 | # File 'tools/dsl.rb', line 79 def pretty_print_instance_variables PRETTY_PRINT_INSTANCE_VARIABLES end |