Sha256: 95e8c538cc46bddbc4688aa89a6d2bce78c5450223e822e6f079fb23da9d0ea1

Contents?: true

Size: 685 Bytes

Versions: 3

Compression:

Stored size: 685 Bytes

Contents

module Inch
  module Evaluation
    class Criteria
      attr_reader :object

      def initialize(&block)
        @block = block
      end

      def evaluate(object)
        @object = object
        instance_eval(&@block)
      end

      NAMES = %w(
        docstring
        parameters
        return_type
        return_description
        code_example_single
        code_example_multi
        unconsidered_tag
        )

      NAMES.each do |name|
        class_eval """
          def #{name}(value = nil)
            if value.nil?
              @#{name}.to_f
            else
              @#{name} = value
            end
          end
        """
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
inch-0.2.2 lib/inch/evaluation/criteria.rb
inch-0.2.1 lib/inch/evaluation/criteria.rb
inch-0.2.0 lib/inch/evaluation/criteria.rb