Class: Blurrily::Map
- Inherits:
-
RawMap
- Object
- RawMap
- Blurrily::Map
- Defined in:
- lib/blurrily/map.rb
Class Method Summary collapse
Instance Method Summary collapse
- #delete(*args) ⇒ Object
- #find(needle, limit = 10) ⇒ Object
- #put(needle, reference, weight = nil) ⇒ Object
- #save(path) ⇒ Object
Class Method Details
.load(path) ⇒ Object
32 33 34 35 36 |
# File 'lib/blurrily/map.rb', line 32 def self.load(path) super(path).tap do |map| map.instance_variable_set :@clean_path, path end end |
Instance Method Details
#delete(*args) ⇒ Object
20 21 22 23 |
# File 'lib/blurrily/map.rb', line 20 def delete(*args) @clean_path = nil super(*args) end |
#find(needle, limit = 10) ⇒ Object
15 16 17 18 |
# File 'lib/blurrily/map.rb', line 15 def find(needle, limit=10) needle = normalize_string needle super(needle, limit) end |
#put(needle, reference, weight = nil) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/blurrily/map.rb', line 8 def put(needle, reference, weight=nil) weight ||= 0 needle = normalize_string needle @clean_path = nil super(needle, reference, weight) end |
#save(path) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/blurrily/map.rb', line 25 def save(path) return if @clean_path == path super(path) @clean_path = path nil end |