Sha256: 8c1d1911ad281b362064b8c3cdae6cac20cff8a5b54f3d6e446bf84047f5f152

Contents?: true

Size: 892 Bytes

Versions: 10

Compression:

Stored size: 892 Bytes

Contents

require 'turnip_formatter/printer'
require 'turnip_formatter/printer/step_extra_args'

module TurnipFormatter
  module Printer
    class Step
      class << self
        include TurnipFormatter::Printer

        def print_out(step)
          render_template(:step, { step: step, step_docs: documents(step.docs) })
        end

        private

        def documents(docs)
          docs.map do |style, template|
            if style == :extra_args
              TurnipFormatter::Printer::StepExtraArgs.print_out(template[:value])
            else
              #
              # Template class which is registered in
              #    +Step::Failure.add_template+
              #    +Step::Pending.add_template+
              # be called.
              #
              template[:klass].build(template[:value])
            end
          end.join("\n")
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
turnip_formatter-0.2.11 lib/turnip_formatter/printer/step.rb
turnip_formatter-0.2.10 lib/turnip_formatter/printer/step.rb
turnip_formatter-0.2.9 lib/turnip_formatter/printer/step.rb
turnip_formatter-0.2.8 lib/turnip_formatter/printer/step.rb
turnip_formatter-0.2.7 lib/turnip_formatter/printer/step.rb
turnip_formatter-0.2.6 lib/turnip_formatter/printer/step.rb
turnip_formatter-0.2.5 lib/turnip_formatter/printer/step.rb
turnip_formatter-0.2.4 lib/turnip_formatter/printer/step.rb
turnip_formatter-0.2.3 lib/turnip_formatter/printer/step.rb
turnip_formatter-0.2.2 lib/turnip_formatter/printer/step.rb