Class: Sastrawi::Stemmer::Cache::ArrayCache

Inherits:
Object
  • Object
show all
Defined in:
lib/sastrawi/stemmer/cache/array_cache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeArrayCache

Returns a new instance of ArrayCache.



7
8
9
# File 'lib/sastrawi/stemmer/cache/array_cache.rb', line 7

def initialize
  @data = {}
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/sastrawi/stemmer/cache/array_cache.rb', line 5

def data
  @data
end

Instance Method Details

#get(key) ⇒ Object



15
16
17
# File 'lib/sastrawi/stemmer/cache/array_cache.rb', line 15

def get(key)
  @data[key.to_sym] if @data.key?(key.to_sym)
end

#has?(key) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/sastrawi/stemmer/cache/array_cache.rb', line 19

def has?(key)
  @data.key?(key.to_sym)
end

#set(key, value) ⇒ Object



11
12
13
# File 'lib/sastrawi/stemmer/cache/array_cache.rb', line 11

def set(key, value)
  @data[key.to_sym] = value
end