Sha256: 4c16509c5ee5e73fc4810a4509e04347ba569554c4ebb856a9aebb39dde87e6c

Contents?: true

Size: 596 Bytes

Versions: 1

Compression:

Stored size: 596 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 = Musterb::NullExtractor.new)
    case 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.1 lib/musterb/extract_values.rb