Class: Lotion::Command

Inherits:
Object
  • Object
show all
Includes:
Notifications
Defined in:
lib/lotion/command.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Notifications

#notification_center, #notify

Constructor Details

#initialize(notification) ⇒ Command

Returns a new instance of Command.



9
10
11
# File 'lib/lotion/command.rb', line 9

def initialize( notification )
  @notification = notification
end

Instance Attribute Details

#notificationObject (readonly)

Returns the value of attribute notification.



12
13
14
# File 'lib/lotion/command.rb', line 12

def notification
  @notification
end

Class Method Details

.call(notification) ⇒ Object



23
24
25
# File 'lib/lotion/command.rb', line 23

def self.call( notification )
  new( notification ).call
end

Instance Method Details

#callObject

TODO this could be a macro on Module

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/lotion/command.rb', line 17

def call
  raise NotImplementedError, 'Lotion::Command subclasses are expected to define #call'
end

#nameObject

TODO delegate



29
30
31
# File 'lib/lotion/command.rb', line 29

def name
  notification.name
end

#objectObject

TODO delegate



35
36
37
# File 'lib/lotion/command.rb', line 35

def object
  notification.object
end

#userInfoObject

TODO delegate



41
42
43
# File 'lib/lotion/command.rb', line 41

def userInfo
  notification.userInfo
end