Class: FieldMatter::DarkMatter
- Inherits:
-
Object
- Object
- FieldMatter::DarkMatter
- Defined in:
- lib/fieldmatter/darkmatter.rb
Instance Attribute Summary collapse
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
-
#repo_path ⇒ Object
readonly
Returns the value of attribute repo_path.
-
#what_matters ⇒ Object
readonly
Returns the value of attribute what_matters.
Instance Method Summary collapse
-
#initialize(repo_path) ⇒ DarkMatter
constructor
A new instance of DarkMatter.
- #update ⇒ Object
Constructor Details
#initialize(repo_path) ⇒ DarkMatter
Returns a new instance of DarkMatter.
13 14 15 |
# File 'lib/fieldmatter/darkmatter.rb', line 13 def initialize( repo_path ) @repo_path = repo_path end |
Instance Attribute Details
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
11 12 13 |
# File 'lib/fieldmatter/darkmatter.rb', line 11 def repo @repo end |
#repo_path ⇒ Object (readonly)
Returns the value of attribute repo_path.
11 12 13 |
# File 'lib/fieldmatter/darkmatter.rb', line 11 def repo_path @repo_path end |
#what_matters ⇒ Object (readonly)
Returns the value of attribute what_matters.
11 12 13 |
# File 'lib/fieldmatter/darkmatter.rb', line 11 def what_matters @what_matters end |
Instance Method Details
#update ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fieldmatter/darkmatter.rb', line 25 def update self.what_matters.each do | key, value | if not FieldMatter::Note.find(filename: key).empty? canon = Base64.encode64(key).chomp id = Ohm.redis.smembers("FieldMatter::Note:filename:#{canon}").pop note = FieldMatter::Note[id] note.update(:tags => value['kMDItemOMUserTags']) else FieldMatter::Note.create(:filename => key, :tags => value['kMDItemOMUserTags']) end end end |