Class: SelfControl::StepBuilder
- Inherits:
-
Object
- Object
- SelfControl::StepBuilder
- Defined in:
- lib/self-control/step_builder.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
Returns the value of attribute actions.
-
#actor ⇒ Object
Returns the value of attribute actor.
-
#default ⇒ Object
Returns the value of attribute default.
-
#if ⇒ Object
Returns the value of attribute if.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#name ⇒ Object
Returns the value of attribute name.
-
#unless ⇒ Object
Returns the value of attribute unless.
Instance Method Summary collapse
- #doable? ⇒ Boolean
-
#initialize(actor, options) ⇒ StepBuilder
constructor
A new instance of StepBuilder.
Constructor Details
#initialize(actor, options) ⇒ StepBuilder
Returns a new instance of StepBuilder.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/self-control/step_builder.rb', line 5 def initialize(actor, ) @actor = actor @actions = [*.delete(:should)].flatten.compact.uniq.map(&:to_sym) @default = .delete(:action) || (@actions.size == 1 ? @actions.first : nil) @name = (.delete(:to) || @actions.join('_or_')).to_sym @if = .delete(:if) @unless = .delete(:unless) @doable = !!(@if || @unless) @meta = end |
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
3 4 5 |
# File 'lib/self-control/step_builder.rb', line 3 def actions @actions end |
#actor ⇒ Object
Returns the value of attribute actor.
3 4 5 |
# File 'lib/self-control/step_builder.rb', line 3 def actor @actor end |
#default ⇒ Object
Returns the value of attribute default.
3 4 5 |
# File 'lib/self-control/step_builder.rb', line 3 def default @default end |
#if ⇒ Object
Returns the value of attribute if.
3 4 5 |
# File 'lib/self-control/step_builder.rb', line 3 def if @if end |
#meta ⇒ Object
Returns the value of attribute meta.
3 4 5 |
# File 'lib/self-control/step_builder.rb', line 3 def @meta end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/self-control/step_builder.rb', line 3 def name @name end |
#unless ⇒ Object
Returns the value of attribute unless.
3 4 5 |
# File 'lib/self-control/step_builder.rb', line 3 def unless @unless end |
Instance Method Details
#doable? ⇒ Boolean
19 20 21 |
# File 'lib/self-control/step_builder.rb', line 19 def doable? @doable end |