Class: Luoma::ExpressionDrop

Inherits:
Drop
  • Object
show all
Defined in:
lib/luoma/drops/expression.rb,
sig/luoma/drops/expression.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Drop

#contains?, #each, #eq?, #fetch, #gt?, #key?, #length, #lt?, #slice, #to_a, #to_s

Constructor Details

#initialize(expr) ⇒ ExpressionDrop

(LambdaExpr) -> void

Parameters:



8
9
10
11
# File 'lib/luoma/drops/expression.rb', line 8

def initialize(expr)
  super()
  @expr = expr
end

Instance Attribute Details

#exprLambdaExpr (readonly)

Returns the value of attribute expr.

Returns:



5
6
7
# File 'lib/luoma/drops/expression.rb', line 5

def expr
  @expr
end

Instance Method Details

#render(context) ⇒ Object



25
26
27
# File 'lib/luoma/drops/expression.rb', line 25

def render(context)
  @expr.to_s
end

#to_primitive(hint, context) ⇒ Object

Signature:

  • (:data | :numeric | :string | :boolean, RenderContext) -> untyped



14
15
16
17
18
19
20
21
22
23
# File 'lib/luoma/drops/expression.rb', line 14

def to_primitive(hint, context)
  case hint
  when :numeric
    :nothing
  when :data, :string
    render(context)
  when :boolean
    true
  end
end