Class: TopStmt

Inherits:
Object
  • Object
show all
Extended by:
BlockSupport
Defined in:
lib/statsailr/block_builder/sts_block.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BlockSupport

type_adjust

Methods included from QuotedStringSupport

#escape_backslashes, #interpret_escape_sequences

Constructor Details

#initialize(str, hash) ⇒ TopStmt

Returns a new instance of TopStmt.



136
137
138
139
# File 'lib/statsailr/block_builder/sts_block.rb', line 136

def initialize( str, hash )
  @command = str
  @opts = hash
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



134
135
136
# File 'lib/statsailr/block_builder/sts_block.rb', line 134

def command
  @command
end

Class Method Details

.new_from_gram_node(node) ⇒ Object



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/statsailr/block_builder/sts_block.rb', line 141

def self.new_from_gram_node( node )
  command_name = node.e1
  top_opts = node.e2
  if (! top_opts.nil? ) && (top_opts.size != 0 )
    hash = {}
    top_opts.each(){|nd|
      top_opt_key = nd.e1
      if(!nd.e2.nil?)
        top_opt_val = type_adjust( nd.e2.e1 , nd.e2.type )
      else
        top_opt_val = nil
      end
      hash[top_opt_key] = top_opt_val
    }
  else
    hash = {}
  end
  return TopStmt.new( command_name, hash)
end