Class: MatrixFormatter::FeatureMatrix

Inherits:
Object
  • Object
show all
Defined in:
lib/matrix_formatter/feature_matrix.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFeatureMatrix

Returns a new instance of FeatureMatrix.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/matrix_formatter/feature_matrix.rb', line 7

def initialize
  @implementors = RSpec.configuration.matrix_implementors
  # results[product][feature][implementor]
  @results = Hash.new { |product_hash, product_key|
    product_hash[product_key] = Hash.new { |feature_hash, feature_key|
      feature_hash[feature_key] = Hash.new { |implementor_hash, implementor_key|
        implementor_hash[implementor_key] = Hash.new
      }
    }
  }
end

Instance Attribute Details

#current_featureObject

Returns the value of attribute current_feature.



3
4
5
# File 'lib/matrix_formatter/feature_matrix.rb', line 3

def current_feature
  @current_feature
end

#current_implementorObject

Returns the value of attribute current_implementor.



3
4
5
# File 'lib/matrix_formatter/feature_matrix.rb', line 3

def current_implementor
  @current_implementor
end

#current_productObject

Returns the value of attribute current_product.



3
4
5
# File 'lib/matrix_formatter/feature_matrix.rb', line 3

def current_product
  @current_product
end

#implementorsObject (readonly)

Returns the value of attribute implementors.



4
5
6
# File 'lib/matrix_formatter/feature_matrix.rb', line 4

def implementors
  @implementors
end

#resultsObject (readonly)

Returns the value of attribute results.



5
6
7
# File 'lib/matrix_formatter/feature_matrix.rb', line 5

def results
  @results
end

Instance Method Details

#add_result(state) ⇒ Object



19
20
21
# File 'lib/matrix_formatter/feature_matrix.rb', line 19

def add_result state
  @results[current_product][current_feature][current_implementor] = state
end

#to_jsonObject



23
24
25
# File 'lib/matrix_formatter/feature_matrix.rb', line 23

def to_json
  MultiJson.encode @results
end