Class: Yaso::Logic::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/yaso/logic/base.rb

Direct Known Subclasses

Failure, Pass, Step, Switch, Wrap

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, invocable:, **options) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
13
14
# File 'lib/yaso/logic/base.rb', line 8

def initialize(name:, invocable:, **options)
  @name = name
  @invocable = invocable
  @fast = options[:fast]
  @on_success = options[:on_success]
  @on_failure = options[:on_failure]
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/yaso/logic/base.rb', line 6

def name
  @name
end

#on_failureObject (readonly)

Returns the value of attribute on_failure.



6
7
8
# File 'lib/yaso/logic/base.rb', line 6

def on_failure
  @on_failure
end

#on_successObject (readonly)

Returns the value of attribute on_success.



6
7
8
# File 'lib/yaso/logic/base.rb', line 6

def on_success
  @on_success
end

Instance Method Details

#add_failure(failure) ⇒ Object



24
25
26
# File 'lib/yaso/logic/base.rb', line 24

def add_failure(failure)
  @failure = failure unless @fast == true || @fast == :failure
end

#add_next_step(step) ⇒ Object



20
21
22
# File 'lib/yaso/logic/base.rb', line 20

def add_next_step(step)
  @next_step = step unless @fast == true || @fast == :success
end

#call(_, _) ⇒ Object

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/yaso/logic/base.rb', line 16

def call(_, _)
  raise NotImplementedError
end