Module: Dhall::Parser::SelectorExpression

Defined in:
lib/dhall/parser.rb

Instance Method Summary collapse

Instance Method Details

#valueObject



157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/dhall/parser.rb', line 157

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