Class: RastSpec
- Inherits:
-
Object
- Object
- RastSpec
- Defined in:
- lib/rast/rast_spec.rb
Overview
CaseFixture.java, containing an actual and specific combination of variables.
Instance Attribute Summary collapse
-
#converters ⇒ Object
readonly
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
-
#default_outcome ⇒ Object
readonly
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
-
#description ⇒ Object
readonly
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
-
#exclude ⇒ Object
Returns the value of attribute exclude.
-
#exclude_clause ⇒ Object
readonly
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
-
#include_clause ⇒ Object
readonly
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
-
#pair ⇒ Object
readonly
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
-
#pair_reversed ⇒ Object
readonly
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
-
#rule ⇒ Object
readonly
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
-
#token_converter ⇒ Object
readonly
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
-
#variables ⇒ Object
readonly
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
Instance Method Summary collapse
- #init_converters(converters: []) ⇒ Object
- #init_exclusion(exclude_clause) ⇒ Object
- #init_inclusion(include_clause) ⇒ Object
- #init_pair(pair_config: {}) ⇒ Object
-
#initialize(description: '', variables: {}, rule: nil, default_outcome: '') ⇒ RastSpec
constructor
A new instance of RastSpec.
Constructor Details
#initialize(description: '', variables: {}, rule: nil, default_outcome: '') ⇒ RastSpec
Returns a new instance of RastSpec.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rast/rast_spec.rb', line 15 def initialize( description: '', variables: {}, rule: nil, default_outcome: '' ) @description = description @variables = variables @pair = {} @pair_reversed = {} @rule = rule @exclude_clause = nil @include_clause = nil @default_outcome = default_outcome end |
Instance Attribute Details
#converters ⇒ Object (readonly)
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
9 10 11 |
# File 'lib/rast/rast_spec.rb', line 9 def converters @converters end |
#default_outcome ⇒ Object (readonly)
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
9 10 11 |
# File 'lib/rast/rast_spec.rb', line 9 def default_outcome @default_outcome end |
#description ⇒ Object (readonly)
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
9 10 11 |
# File 'lib/rast/rast_spec.rb', line 9 def description @description end |
#exclude ⇒ Object
Returns the value of attribute exclude.
13 14 15 |
# File 'lib/rast/rast_spec.rb', line 13 def exclude @exclude end |
#exclude_clause ⇒ Object (readonly)
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
9 10 11 |
# File 'lib/rast/rast_spec.rb', line 9 def exclude_clause @exclude_clause end |
#include_clause ⇒ Object (readonly)
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
9 10 11 |
# File 'lib/rast/rast_spec.rb', line 9 def include_clause @include_clause end |
#pair ⇒ Object (readonly)
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
9 10 11 |
# File 'lib/rast/rast_spec.rb', line 9 def pair @pair end |
#pair_reversed ⇒ Object (readonly)
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
9 10 11 |
# File 'lib/rast/rast_spec.rb', line 9 def pair_reversed @pair_reversed end |
#rule ⇒ Object (readonly)
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
9 10 11 |
# File 'lib/rast/rast_spec.rb', line 9 def rule @rule end |
#token_converter ⇒ Object (readonly)
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
9 10 11 |
# File 'lib/rast/rast_spec.rb', line 9 def token_converter @token_converter end |
#variables ⇒ Object (readonly)
token_converter is the mapping of a variable token to a converter converters is a list of converters used via positional tokens.
9 10 11 |
# File 'lib/rast/rast_spec.rb', line 9 def variables @variables end |
Instance Method Details
#init_converters(converters: []) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/rast/rast_spec.rb', line 39 def init_converters(converters: []) @converters = converters @token_converter = {} @variables.keys.each_with_index do |key, index| @variables[key].each do |element| converter = RuleEvaluator::DEFAULT_CONVERT_HASH[element.class] || converters[index] @token_converter[element.to_s] = converter end end self end |
#init_exclusion(exclude_clause) ⇒ Object
54 55 56 57 |
# File 'lib/rast/rast_spec.rb', line 54 def init_exclusion(exclude_clause) @exclude_clause = exclude_clause self end |
#init_inclusion(include_clause) ⇒ Object
59 60 61 62 |
# File 'lib/rast/rast_spec.rb', line 59 def init_inclusion(include_clause) @include_clause = include_clause self end |
#init_pair(pair_config: {}) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/rast/rast_spec.rb', line 31 def init_pair(pair_config: {}) @pair[pair_config.keys.first.to_s] = pair_config.values.first.to_s array = [@pair.to_a.first.reverse].first @pair_reversed = { array.first.to_s => array.last } self end |