Class: Piggy::Event

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Naming
Includes:
ActiveModel::Serializers::Xml
Defined in:
lib/piggy/event.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#titleObject

Returns the value of attribute title.



11
12
13
# File 'lib/piggy/event.rb', line 11

def title
  @title
end

Class Method Details

.allObject



20
21
22
# File 'lib/piggy/event.rb', line 20

def self.all
  store.all.reverse.join("\n")
end

.any?Boolean

Returns:

  • (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

#attributesObject



28
29
30
# File 'lib/piggy/event.rb', line 28

def attributes
  @attributes ||= {'title' => 'nil'}
end