Class: Secret_Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/hash.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash:) ⇒ Secret_Hash



4
5
6
# File 'lib/hash.rb', line 4

def initialize(hash:)
  @hash = hash
end

Instance Attribute Details

#hashObject

Returns the value of attribute hash.



2
3
4
# File 'lib/hash.rb', line 2

def hash
  @hash
end

Instance Method Details

#[](key) ⇒ Object



8
9
10
# File 'lib/hash.rb', line 8

def [](key)
  @hash[key]
end

#[]=(key, value) ⇒ Object



12
13
14
15
16
# File 'lib/hash.rb', line 12

def []=(key, value)
  raise "No writing please"

  @hash[key] = value
end