Class: Piggy::Event
- Inherits:
-
Object
- Object
- Piggy::Event
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Serializers::Xml
- Defined in:
- lib/piggy/event.rb
Instance Attribute Summary collapse
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#title ⇒ Object
Returns the value of attribute title.
11 12 13 |
# File 'lib/piggy/event.rb', line 11 def title @title end |
Class Method Details
.all ⇒ Object
20 21 22 |
# File 'lib/piggy/event.rb', line 20 def self.all store.all.reverse.join("\n") end |
.any? ⇒ Boolean
24 25 26 |
# File 'lib/piggy/event.rb', line 24 def self.any? store.any? end |
.create(title) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/piggy/event.rb', line 13 def self.create(title) event = Event.new(title) store.save(title) Subscribers.notify(event) event end |
Instance Method Details
#attributes ⇒ Object
28 29 30 |
# File 'lib/piggy/event.rb', line 28 def attributes @attributes ||= {'title' => 'nil'} end |