class Dhall::TypeChecker::RecordSelection::Selector
Public Class Methods
for(annotated_record)
click to toggle source
# File lib/dhall/typecheck.rb, line 589 def self.for(annotated_record) typ = annotated_record.type.normalize if KINDS.include?(typ) TypeSelector.new(annotated_record.value) elsif typ.class == Dhall::RecordType new(typ) else raise TypeError, "RecordSelection on #{typ}" end end
new(type)
click to toggle source
# File lib/dhall/typecheck.rb, line 600 def initialize(type) @fetch_from = type.record end
Public Instance Methods
select(selector)
click to toggle source
# File lib/dhall/typecheck.rb, line 604 def select(selector) @fetch_from.fetch(selector) do raise TypeError, "#{@fetch_from} has no field #{@selector}" end end