class DataMaps::Dsl::Mapping::ConditionsDsl

Structure to describe a field mapping

Public Class Methods

new() click to toggle source
# File lib/data_maps/dsl/mapping/conditions_dsl.rb, line 8
def initialize
  self.whens = {}
  self.thens = {}
end

Public Instance Methods

is(condition, option)
Alias for: when
so(action, option)
Alias for: then
then(action, option) click to toggle source
# File lib/data_maps/dsl/mapping/conditions_dsl.rb, line 18
def then(action, option)
  self.thens[action] = option
end
Also aliased as: so
to_h() click to toggle source

Serialize DSL to an Hash

# File lib/data_maps/dsl/mapping/conditions_dsl.rb, line 24
def to_h
  data = {
    when: whens,
    then: thens
  }
  data.stringify_keys
end
when(condition, option) click to toggle source
# File lib/data_maps/dsl/mapping/conditions_dsl.rb, line 13
def when(condition, option)
  self.whens[condition] = option
end
Also aliased as: is