Class: Oldtime::Instance

Inherits:
Object
  • Object
show all
Defined in:
lib/oldtime/instance.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action, instance, before_hooks = [], after_hooks = []) ⇒ Instance

Returns a new instance of Instance.



5
6
7
8
9
10
# File 'lib/oldtime/instance.rb', line 5

def initialize(action, instance, before_hooks=[], after_hooks=[])
  @action = action
  @instance = instance
  @before_hooks = before_hooks
  @after_hooks = after_hooks
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



3
4
5
# File 'lib/oldtime/instance.rb', line 3

def action
  @action
end

#instanceObject (readonly)

Returns the value of attribute instance.



3
4
5
# File 'lib/oldtime/instance.rb', line 3

def instance
  @instance
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
# File 'lib/oldtime/instance.rb', line 12

def run
  run_hooks(:before, @before_hooks)

  run_instance(@action, @instance)

  run_hooks(:after, @after_hooks)
end