Class: Course::Step
- Inherits:
-
Object
- Object
- Course::Step
- Defined in:
- lib/course/step.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #block? ⇒ Boolean
-
#initialize(target, block, **options) ⇒ Step
constructor
A new instance of Step.
- #method? ⇒ Boolean
Constructor Details
#initialize(target, block, **options) ⇒ Step
Returns a new instance of Step.
7 8 9 10 11 12 13 14 |
# File 'lib/course/step.rb', line 7 def initialize(target, block, **) raise ArgumentError, 'Cannot create a step with both name and block' if !target.nil? && !block.nil? raise ArgumentError, 'Step name or block should be passed' if target.nil? && block.nil? @target = target = @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
5 6 7 |
# File 'lib/course/step.rb', line 5 def block @block end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/course/step.rb', line 5 def end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
5 6 7 |
# File 'lib/course/step.rb', line 5 def target @target end |
Instance Method Details
#block? ⇒ Boolean
20 21 22 |
# File 'lib/course/step.rb', line 20 def block? !@block.nil? end |
#method? ⇒ Boolean
16 17 18 |
# File 'lib/course/step.rb', line 16 def method? target.is_a?(String) || target.is_a?(Symbol) end |