Class: Gandiva::ExpressionBuilder::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/gandiva/expression-builder/record.rb

Instance Method Summary collapse

Constructor Details

#initialize(schema) ⇒ Record

Returns a new instance of Record.



21
22
23
# File 'lib/gandiva/expression-builder/record.rb', line 21

def initialize(schema)
  @schema = schema
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



30
31
32
33
# File 'lib/gandiva/expression-builder/record.rb', line 30

def method_missing(name, *args)
  return super unless args.empty?
  self[name] || super
end

Instance Method Details

#[](name) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/gandiva/expression-builder/record.rb', line 35

def [](name)
  field = @schema[name]
  if field
    Field.new(field)
  else
    nil
  end
end

#respond_to_missing?(name, include_private) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
# File 'lib/gandiva/expression-builder/record.rb', line 25

def respond_to_missing?(name, include_private)
  return true if @schema[name]
  super
end