class Moodswings::Mood
Attributes
filepath[R]
Public Class Methods
new(filepath)
click to toggle source
# File lib/moodswings/mood.rb, line 11 def initialize(filepath) @filepath = filepath end
open(name)
click to toggle source
# File lib/moodswings/mood.rb, line 7 def self.open(name) new File.expand_path("#{Storage::DB_PATH}/#{name}.mood") end
Public Instance Methods
contents()
click to toggle source
# File lib/moodswings/mood.rb, line 23 def contents @contents ||= file.read end
file()
click to toggle source
# File lib/moodswings/mood.rb, line 19 def file @file ||= File.open File.expand_path(@filepath) end
load()
click to toggle source
# File lib/moodswings/mood.rb, line 27 def load self.instance_eval(contents) end
name()
click to toggle source
# File lib/moodswings/mood.rb, line 15 def name File.basename(@filepath) end