Class: Cure::Dsl::Transformations::Candidate

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(column, named_range:, ref: "_default") ⇒ Candidate

Returns a new instance of Candidate.



36
37
38
39
40
41
42
43
# File 'lib/cure/dsl/transformations.rb', line 36

def initialize(column, named_range:, ref: "_default")
  @column = column
  @named_range = named_range
  @ref = ref

  @translations = []
  @no_match_translation = nil
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



34
35
36
# File 'lib/cure/dsl/transformations.rb', line 34

def column
  @column
end

#named_rangeObject (readonly)

Returns the value of attribute named_range.



34
35
36
# File 'lib/cure/dsl/transformations.rb', line 34

def named_range
  @named_range
end

#no_match_translationObject (readonly)

Returns the value of attribute no_match_translation.



34
35
36
# File 'lib/cure/dsl/transformations.rb', line 34

def no_match_translation
  @no_match_translation
end

#refObject (readonly)

Returns the value of attribute ref.



34
35
36
# File 'lib/cure/dsl/transformations.rb', line 34

def ref
  @ref
end

#translationsObject (readonly)

Returns the value of attribute translations.



34
35
36
# File 'lib/cure/dsl/transformations.rb', line 34

def translations
  @translations
end

Instance Method Details

#if_no_match(&block) ⇒ Object



55
56
57
58
59
60
61
62
63
# File 'lib/cure/dsl/transformations.rb', line 55

def if_no_match(&block)
  no_match_translation = Translation.new
  no_match_translation.instance_exec(&block)

  @no_match_translation = Transformation::Translation.new(
    no_match_translation.strategy,
    no_match_translation.generator
  )
end

#with_translation(&block) ⇒ Object



45
46
47
48
49
50
51
52
53
# File 'lib/cure/dsl/transformations.rb', line 45

def with_translation(&block)
  translation = Translation.new
  translation.instance_exec(&block)

  @translations << Transformation::Translation.new(
    translation.strategy,
    translation.generator
  )
end