Class: Sastrawi::Stemmer::Cache::ArrayCache
- Inherits:
-
Object
- Object
- Sastrawi::Stemmer::Cache::ArrayCache
- Defined in:
- lib/sastrawi/stemmer/cache/array_cache.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #get(key) ⇒ Object
- #has?(key) ⇒ Boolean
-
#initialize ⇒ ArrayCache
constructor
A new instance of ArrayCache.
- #set(key, value) ⇒ Object
Constructor Details
#initialize ⇒ ArrayCache
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
#data ⇒ Object (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
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 |