Sha256: dd6716a50aa03199dccf485f09916daacbfbee91c94b5083500bfb40ec803d0b

Contents?: true

Size: 508 Bytes

Versions: 1

Compression:

Stored size: 508 Bytes

Contents

module Trailblazer
  class Context
    class IndifferentAccess < Context
      def [](name)
        # TODO: well...
        @mutable_options.key?(name.to_sym) and return @mutable_options[name.to_sym]
        @mutable_options.key?(name.to_s) and return @mutable_options[name.to_s]
        @wrapped_options.key?(name.to_sym) and return @wrapped_options[name.to_sym]
        @wrapped_options[name.to_s]
      end

      def key?(name)
        super(name.to_sym) || super(name.to_s)
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trailblazer-context-0.1.4 lib/trailblazer/context/indifferent_access.rb