class DSL::Var::Table - ripper: Ruby Standard Library Documentation

# class DSL::Var::Table

### Public Class Methods

new(&block) click to toggle source
Calls superclass method

    # File ripper/tools/dsl.rb, line 48
    def initialize(&block)
      super() {|tbl, arg|
        tbl.fetch(arg, &block)
      }
    end

### Public Instance Methods

add(&block) click to toggle source

    # File ripper/tools/dsl.rb, line 60
    def add(&block)
      v = new_var
      self[v] = Var.new(self, v, &block)
    end

defined?(name) click to toggle source

    # File ripper/tools/dsl.rb, line 65
    def defined?(name)
      name = name.to_s
      any? {|_, v| v.var == name}
    end

fetch(arg, &block) click to toggle source
Calls superclass method

    # File ripper/tools/dsl.rb, line 54
    def fetch(arg, &block)
      super {
        self[arg] = Var.new(self, arg, &block)
      }
    end

new_var() click to toggle source

    # File ripper/tools/dsl.rb, line 70
    def new_var
      "v#{size+1}"
    end