Class: Cure::Dsl::Transformations
- Inherits:
-
Object
- Object
- Cure::Dsl::Transformations
- Defined in:
- lib/cure/dsl/transformations.rb
Defined Under Namespace
Classes: Candidate, Translation
Instance Attribute Summary collapse
-
#candidates ⇒ Object
readonly
Returns the value of attribute candidates.
-
#placeholders ⇒ Object
readonly
Returns the value of attribute placeholders.
Instance Method Summary collapse
- #candidate(column:, named_range: "_default", options: {}, &block) ⇒ Object
-
#initialize ⇒ Transformations
constructor
A new instance of Transformations.
- #place_holders(hash) ⇒ Object
Constructor Details
#initialize ⇒ Transformations
Returns a new instance of Transformations.
13 14 15 16 |
# File 'lib/cure/dsl/transformations.rb', line 13 def initialize @candidates = [] @placeholders = [] end |
Instance Attribute Details
#candidates ⇒ Object (readonly)
Returns the value of attribute candidates.
11 12 13 |
# File 'lib/cure/dsl/transformations.rb', line 11 def candidates @candidates end |
#placeholders ⇒ Object (readonly)
Returns the value of attribute placeholders.
11 12 13 |
# File 'lib/cure/dsl/transformations.rb', line 11 def placeholders @placeholders end |
Instance Method Details
#candidate(column:, named_range: "_default", options: {}, &block) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/cure/dsl/transformations.rb', line 18 def candidate(column:, named_range: "_default", options: {}, &block) candidate = Candidate.new(column, named_range: named_range) candidate.instance_exec(&block) @candidates << Transformation::Candidate .new(candidate.column, named_range: candidate.named_range, options: ) .with_translations(candidate.translations) .with_no_match_translation(candidate.no_match_translation) end |
#place_holders(hash) ⇒ Object
28 29 30 |
# File 'lib/cure/dsl/transformations.rb', line 28 def place_holders(hash) @placeholders = hash end |