Sha256: 6cbfc710983354b6f5440deef9598dbd434b1da67a9b320b8cf1f656e1cbd581

Contents?: true

Size: 960 Bytes

Versions: 10

Compression:

Stored size: 960 Bytes

Contents

# -*- coding: utf-8 -*-

module TurnipFormatter
  class Step
    attr_reader :name, :docs, :example

    class << self
      def templates
        @templates ||= {}
      end

      def add_template(status, klass = nil, &block)
        templates[status] ||= {}
        templates[status][klass] = { klass: klass, block: block }
      end

      def remove_template(status, klass)
        templates[status].delete(klass)
        templates.delete(status.to_sym) if templates[status.to_sym].empty?
      end

      def status
        ''
      end
    end

    #
    # @param  [RSpec::Core::Example]  example
    # @param  [Hash]  description
    #
    def initialize(example, description)
      @example = example
      @name = description[:keyword] + description[:name]
      @docs = { extra_args: { klass: nil, value: description[:extra_args] } }
    end

    def attention?
      !status.empty?
    end

    def status
      self.class.status
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
turnip_formatter-0.2.9 lib/turnip_formatter/step.rb
turnip_formatter-0.2.8 lib/turnip_formatter/step.rb
turnip_formatter-0.2.7 lib/turnip_formatter/step.rb
turnip_formatter-0.2.6 lib/turnip_formatter/step.rb
turnip_formatter-0.2.5 lib/turnip_formatter/step.rb
turnip_formatter-0.2.4 lib/turnip_formatter/step.rb
turnip_formatter-0.2.3 lib/turnip_formatter/step.rb
turnip_formatter-0.2.2 lib/turnip_formatter/step.rb
turnip_formatter-0.2.1 lib/turnip_formatter/step.rb
turnip_formatter-0.2.0 lib/turnip_formatter/step.rb