Class: Dhall::Enum

Inherits:
Union show all
Defined in:
lib/dhall/ast.rb,
lib/dhall/normalize.rb

Instance Method Summary collapse

Methods inherited from Union

decode, from, #selection_syntax, #syntax

Methods inherited from Expression

#&, #*, #+, #as_dhall, #cache_key, #call, #concat, decode, #deep_merge, #deep_merge_type, #dhall_eq, #digest, #fetch, #fusion, #merge, #resolve, #shift, #slice, #substitute, #to_cbor, #to_proc, #|

Instance Method Details

#as_jsonObject



963
964
965
# File 'lib/dhall/ast.rb', line 963

def as_json
  selection_syntax.as_json
end

#extractObject



959
960
961
# File 'lib/dhall/ast.rb', line 959

def extract
  tag.to_sym
end

#normalizeObject



348
349
350
# File 'lib/dhall/normalize.rb', line 348

def normalize
  with(alternatives: alternatives.normalize)
end

#reduce(handlers) ⇒ Object



949
950
951
952
953
# File 'lib/dhall/ast.rb', line 949

def reduce(handlers)
  handlers = handlers.to_h
  handler = handlers.fetch(tag.to_sym) { handlers.fetch(tag) }
  handler
end

#to_sObject



955
956
957
# File 'lib/dhall/ast.rb', line 955

def to_s
  tag
end