Sha256: 10aed643da324d884f270ed122cb33ed4a52cc979b992c2e908d5d99a70472e3

Contents?: true

Size: 553 Bytes

Versions: 2

Compression:

Stored size: 553 Bytes

Contents

# frozen_string_literal: true

module Course
  class Step
    attr_reader :target, :options, :block

    def initialize(target, block, **options)
      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
      @options = options
      @block = block
    end

    def method?
      target.is_a?(String) || target.is_a?(Symbol)
    end

    def block?
      !@block.nil?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
course-0.2.1 lib/course/step.rb
course-0.2.0 lib/course/step.rb