Class: Noteman::Note
- Inherits:
-
Object
- Object
- Noteman::Note
- Includes:
- Config, MDProcessor
- Defined in:
- lib/noteman/note.rb
Constant Summary
Constants included from Config
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#content ⇒ Object
Returns the value of attribute content.
-
#file ⇒ Object
Returns the value of attribute file.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#tags ⇒ Object
Returns the value of attribute tags.
Attributes included from Config
Instance Method Summary collapse
- #contains?(keywords) ⇒ Boolean
-
#initialize(file) ⇒ Note
constructor
A new instance of Note.
- #view ⇒ Object
- #with_tags?(tags) ⇒ Boolean
Methods included from MDProcessor
#get_md, #get_metadata, #remove_metadata
Methods included from Config
Constructor Details
#initialize(file) ⇒ Note
Returns a new instance of Note.
6 7 8 9 10 11 |
# File 'lib/noteman/note.rb', line 6 def initialize(file) @file = file @content = File.read file = @content @body = @content end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/noteman/note.rb', line 4 def body @body end |
#content ⇒ Object
Returns the value of attribute content.
4 5 6 |
# File 'lib/noteman/note.rb', line 4 def content @content end |
#file ⇒ Object
Returns the value of attribute file.
4 5 6 |
# File 'lib/noteman/note.rb', line 4 def file @file end |
#metadata ⇒ Object
Returns the value of attribute metadata.
4 5 6 |
# File 'lib/noteman/note.rb', line 4 def end |
#tags ⇒ Object
Returns the value of attribute tags.
4 5 6 |
# File 'lib/noteman/note.rb', line 4 def end |
Instance Method Details
#contains?(keywords) ⇒ Boolean
30 31 32 |
# File 'lib/noteman/note.rb', line 30 def contains?(keywords) keywords.all? { |word| body.downcase.include? word.downcase } end |
#view ⇒ Object
34 35 36 |
# File 'lib/noteman/note.rb', line 34 def view system("open -a \"#{config['view_with']}\" #{file}") end |
#with_tags?(tags) ⇒ Boolean
21 22 23 24 25 26 27 28 |
# File 'lib/noteman/note.rb', line 21 def () if and ['tags'] if ( - ['tags']).empty? return true end end false end |