Module: Dhall::Parser::SelectorExpression

Defined in:
lib/dhall/parser.rb

Instance Method Summary collapse

Instance Method Details

#valueObject



151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/dhall/parser.rb', line 151

def value
  record = capture(:primitive_expression).value
  captures(:selector).map(&:value).reduce(record) do |rec, sels|
    if sels.is_a?(Array)
      RecordProjection.for(rec, sels)
    elsif sels.is_a?(Dhall::Expression)
      RecordProjectionByExpression.new(record: rec, selector: sels)
    else
      RecordSelection.new(record: rec, selector: sels)
    end
  end
end