Class: Flounder::SymbolExtensions::Modifier

Inherits:
Struct
  • Object
show all
Defined in:
lib/flounder/symbol_extensions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#kindObject

Returns the value of attribute kind

Returns:

  • (Object)

    the current value of kind



3
4
5
# File 'lib/flounder/symbol_extensions.rb', line 3

def kind
  @kind
end

#symObject

Returns the value of attribute sym

Returns:

  • (Object)

    the current value of sym



3
4
5
# File 'lib/flounder/symbol_extensions.rb', line 3

def sym
  @sym
end

Instance Method Details

#to_arel_field(entity) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/flounder/symbol_extensions.rb', line 4

def to_arel_field entity
  af = case sym
    when Symbol
      entity[sym].arel_field
    when Flounder::Field
      sym.arel_field
    when Flounder::Expression::Expr
      sym.to_immediate.to_arel_field
  else
    fail "ASSERTION FAILURE: Unknown type in field.sym: #{field.sym.inspect}."
  end
end