Sha256: 427d171940393fa3eea5508bab45234d3470254e7e92ae81c0e3acb67b36667d

Contents?: true

Size: 618 Bytes

Versions: 1

Compression:

Stored size: 618 Bytes

Contents

module Musterb::ExtractValues
  def value
    @context.value
  end

  def [](symbol)
    @context[symbol]
  end

  def chain(symbol)
    Musterb::Chain.new self[symbol]
  end

  def self.new_context(value, old_context = @context)
    case value
    when Musterb::Extractor
      value
    when Hash
      Musterb::HashExtractor.new(value, old_context)
    when nil
      Musterb::NullExtractor.new(old_context)
    else
      Musterb::ObjectExtractor.new(value, old_context)
    end
  end

  private
  def new_context(value, old_context = @context)
    Musterb::ExtractValues.new_context(value, old_context)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
musterb-1.0.0 lib/musterb/extract_values.rb