Class: Moodwall::Mood
Instance Attribute Summary collapse
-
#current ⇒ Object
Returns the value of attribute current.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Record
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, current: false) ⇒ Mood
constructor
A new instance of Mood.
Methods inherited from Record
#==, all, #delete, find!, #new_record?, next_id, #reload, repository, reset, #save, transaction
Constructor Details
#initialize(name:, current: false) ⇒ Mood
Returns a new instance of Mood.
6 7 8 9 |
# File 'lib/moodwall/mood.rb', line 6 def initialize(name:, current: false) @name = name @current = current end |
Instance Attribute Details
#current ⇒ Object
Returns the value of attribute current.
4 5 6 |
# File 'lib/moodwall/mood.rb', line 4 def current @current end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/moodwall/mood.rb', line 3 def name @name end |
Class Method Details
.current ⇒ Object
11 12 13 |
# File 'lib/moodwall/mood.rb', line 11 def self.current all.find { |m| m.current == true } end |
.find_by_name(name) ⇒ Object
15 16 17 |
# File 'lib/moodwall/mood.rb', line 15 def self.find_by_name(name) all.find { |m| m.name.casecmp(name).zero? } end |