class Noteman::Note

Attributes

body[RW]
content[RW]
file[RW]
metadata[RW]
tags[RW]

Public Class Methods

new(file) click to toggle source
# File lib/noteman/note.rb, line 6
def initialize(file)
  @file = file
  @content = File.read file
  @metadata = get_metadata @content
  @body = remove_metadata @content
end

Public Instance Methods

contains?(keywords) click to toggle source
# File lib/noteman/note.rb, line 30
def contains?(keywords)
  keywords.all? { |word| body.downcase.include? word.downcase }
end
view() click to toggle source
# File lib/noteman/note.rb, line 34
def view
  system("open -a \"#{config['view_with']}\" #{file}")
end
with_tags?(tags) click to toggle source
# File lib/noteman/note.rb, line 21
def with_tags?(tags)
  if metadata and metadata['tags']
    if (tags - metadata['tags']).empty?
      return true
    end
  end
  false
end