module Dhall::Operator::FetchFromMerge

Public Instance Methods

fetch(selector) click to toggle source
Calls superclass method
# File lib/dhall/ast.rb, line 368
def fetch(selector)
        first = public_send(self.class::FETCH1K)
        second = public_send(self.class::FETCH2K)
        if first.is_a?(Record)
                first.fetch(selector) { second.fetch(selector) }
        elsif second.is_a?(Record)
                fetch_second_record(first, second, selector)
        else
                super
        end
end
fetch_second_record(first, second, selector) click to toggle source
# File lib/dhall/ast.rb, line 355
def fetch_second_record(first, second, selector)
        rec = self.class.new(
                self.class::FETCH2K => second.slice(selector),
                self.class::FETCH1K => first
        ).normalize

        if rec.class == self.class
                RecordSelection.new(record: rec, selector: selector)
        else
                rec.fetch(selector)
        end
end