Sha256: b9da7dc450206a563019d770fefee0ec63bc129cfb213a8be79942d349ef9896

Contents?: true

Size: 784 Bytes

Versions: 7

Compression:

Stored size: 784 Bytes

Contents

# frozen_string_literal: true

require 'steppy/version'
require 'steppy/cache'
require 'steppy/error'
require 'steppy/class_methods'
require 'steppy/instance_methods'

# The Steppy module you'll include in your classes to give them steps!
module Steppy
  def self.included(base)
    base.extend ClassMethods
    base.include InstanceMethods
  end

  # :reek:TooManyStatements
  def self.parse_step(method:, args:, block: nil)
    args[:condition] = -> { steppy_run_condition(args[:if]) } if args.key?(:if)

    args[:condition] = -> { !steppy_run_condition(args[:unless]) } if args.key?(:unless)

    args[:prefix] = :step unless args.key?(:prefix)

    if method.is_a?(Proc)
      block = method
      method = nil
    end

    { method: method, args: args, block: block }
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
steppy-1.0.8 lib/steppy.rb
steppy-1.0.7 lib/steppy.rb
steppy-1.0.6 lib/steppy.rb
steppy-1.0.5 lib/steppy.rb
steppy-1.0.4 lib/steppy.rb
steppy-1.0.3 lib/steppy.rb
steppy-1.0.2 lib/steppy.rb