Class: Cure::Dsl::Transformations

Inherits:
Object
  • Object
show all
Defined in:
lib/cure/dsl/transformations.rb

Defined Under Namespace

Classes: Candidate, Translation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTransformations

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

#candidatesObject (readonly)

Returns the value of attribute candidates.



11
12
13
# File 'lib/cure/dsl/transformations.rb', line 11

def candidates
  @candidates
end

#placeholdersObject (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: 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