Class: Meathook::Hook

Inherits:
Object
  • Object
show all
Defined in:
lib/meathook/hook.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hn, d) ⇒ Hook

Returns a new instance of Hook.



5
6
7
8
9
10
11
12
13
# File 'lib/meathook/hook.rb', line 5

def initialize(hn, d)
  self.name = hn
  self.data = d
  self.commands = []

  self.data.each_pair do |cname, cdata|
    self.commands << Meathook::Command.new(self.name, cname, cdata)
  end
end

Instance Attribute Details

#commandsObject

Returns the value of attribute commands.



3
4
5
# File 'lib/meathook/hook.rb', line 3

def commands
  @commands
end

#dataObject

Returns the value of attribute data.



3
4
5
# File 'lib/meathook/hook.rb', line 3

def data
  @data
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/meathook/hook.rb', line 3

def name
  @name
end

Instance Method Details

#each_command(&block) ⇒ Object



15
16
17
# File 'lib/meathook/hook.rb', line 15

def each_command(&block)
  self.commands.each{|c| yield c}
end