Class: Dhall::RecordSelection
- Inherits:
-
Expression
show all
- Defined in:
- lib/dhall/ast.rb,
lib/dhall/binary.rb,
lib/dhall/normalize.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Expression
#&, #*, #+, #annotate, #as_dhall, #cache_key, #concat, #deep_merge, #deep_merge_type, #dhall_eq, #digest, #fetch, #fusion, #merge, #resolve, #shift, #slice, #substitute, #to_binary, #to_cbor, #to_proc, #to_s, #|
Class Method Details
.decode(record, selector) ⇒ Object
156
157
158
|
# File 'lib/dhall/binary.rb', line 156
def self.decode(record, selector)
new(record: Dhall.decode(record), selector: selector)
end
|
Instance Method Details
#as_json ⇒ Object
895
896
897
|
# File 'lib/dhall/ast.rb', line 895
def as_json
[9, record.as_json, selector]
end
|
#call(value) ⇒ Object
887
888
889
890
891
892
893
|
# File 'lib/dhall/ast.rb', line 887
def call(value)
if record.is_a?(UnionType)
record.get_constructor(selector).call(value)
else
Application.new(function: self, argument: value)
end
end
|
#normalize ⇒ Object
342
343
344
|
# File 'lib/dhall/normalize.rb', line 342
def normalize
record.normalize.fetch(selector)
end
|