Sha256: 14e6bd090b0ce9d1eac1638e53cfc75d235d2ca49874ffd023d9b64ecb67b825

Contents?: true

Size: 318 Bytes

Versions: 3

Compression:

Stored size: 318 Bytes

Contents

class Musterb::InstanceVariableExtractor
  attr_reader :parent, :value

  def initialize(value, parent)
    @value = value
    @parent = parent
  end

  def [](symbol)
    if value.instance_variable_defined?("@#{symbol}")
      value.instance_variable_get("@#{symbol}")
    else
      @parent[symbol]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
musterb-1.0.1 lib/musterb/instance_variable_extractor.rb
musterb-0.2.0 lib/musterb/instance_variable_extractor.rb
musterb-0.1.2 lib/musterb/instance_variable_extractor.rb