Class: Hold::HashRepository::KeyCell

Inherits:
Object
  • Object
show all
Includes:
Cell
Defined in:
lib/hold/interfaces/hash_repository.rb

Instance Method Summary collapse

Methods included from Cell

#get_unless_empty, #set_if_empty, #set_unless_empty, #value, #value=

Constructor Details

#initialize(hash_repository, key) ⇒ KeyCell

Returns a new instance of KeyCell.



39
40
41
# File 'lib/hold/interfaces/hash_repository.rb', line 39

def initialize(hash_repository, key)
  @hash_repository, @key = hash_repository, key
end

Instance Method Details

#can_get_class?(klass) ⇒ Boolean

Returns:

  • (Boolean)


59
# File 'lib/hold/interfaces/hash_repository.rb', line 59

def can_get_class?(klass); @hash_repository.can_get_class?(klass); end

#can_set_class?(klass) ⇒ Boolean

Returns:

  • (Boolean)


60
# File 'lib/hold/interfaces/hash_repository.rb', line 60

def can_set_class?(klass); @hash_repository.can_set_class?(klass); end

#clearObject



51
52
53
# File 'lib/hold/interfaces/hash_repository.rb', line 51

def clear
  @hash_repository.clear_key(@key)
end

#empty?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/hold/interfaces/hash_repository.rb', line 55

def empty?
  @hash_repository.has_key?(@key)
end

#getObject



43
44
45
# File 'lib/hold/interfaces/hash_repository.rb', line 43

def get
  @hash_repository.get_with_key(@key)
end

#set(value) ⇒ Object



47
48
49
# File 'lib/hold/interfaces/hash_repository.rb', line 47

def set(value)
  @hash_repository.set_with_key(@key, value)
end