Class: DataBlock

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, script) ⇒ DataBlock

Returns a new instance of DataBlock.



166
167
168
169
170
# File 'lib/statsailr/block_builder/sts_block.rb', line 166

def initialize( str, hash, script)
  @out = str
  @opts = hash
  @script = script
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



164
165
166
# File 'lib/statsailr/block_builder/sts_block.rb', line 164

def opts
  @opts
end

#outObject (readonly)

Returns the value of attribute out.



164
165
166
# File 'lib/statsailr/block_builder/sts_block.rb', line 164

def out
  @out
end

#scriptObject (readonly)

Returns the value of attribute script.



164
165
166
# File 'lib/statsailr/block_builder/sts_block.rb', line 164

def script
  @script
end

Class Method Details

.new_from_gram_node(node) ⇒ Object



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/statsailr/block_builder/sts_block.rb', line 172

def self.new_from_gram_node( node )
  out_df = type_adjust( node.e1.e1, node.e1.type )
  data_hash = {}
  data_opts = node.e2

  if ! data_opts.nil?
    data_opts.each(){|nd|
      data_opt_key = nd.e1
      if(!nd.e2.nil?)
        data_opt_val = type_adjust( nd.e2.e1 , nd.e2.type )
      else
        data_opt_val = nil
      end
      data_hash[data_opt_key] = data_opt_val
    }
  else
    data_opts = {}
  end

  data_script = type_adjust( node.e3.e1, node.e3.type )

  return DataBlock.new( out_df , data_hash , data_script)
end