Sha256: 9e0c4efce30fed84b999432bcbead366f05616386365874948d869ad017373c8

Contents?: true

Size: 424 Bytes

Versions: 1

Compression:

Stored size: 424 Bytes

Contents

class SmartHash < Hash
  # Non-strict SmartHash
  #
  #   person = SmartHash::Loose[]
  #
  # is equivalent to:
  #
  #   person = SmartHash[]
  #   person.strict = false
  class Loose < ::SmartHash
    # See SmartHash#initialize.
    def initialize(*args)
      super
      @strict = false
    end

    # See SmartHash::[].
    def self.[](*args)
      super.tap do |_|
        _.strict = false
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smart_hash-0.1.0 lib/smart_hash/loose.rb