Class: I18nAdd::YamlProcessor::KeyContext

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n_add/yaml_processor.rb

Overview

Encapsulates context for processing a single key level

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, level:, translation:, indentation:) ⇒ KeyContext

Returns a new instance of KeyContext.



243
244
245
246
247
248
# File 'lib/i18n_add/yaml_processor.rb', line 243

def initialize(key:, level:, translation:, indentation:)
  @key = key
  @level = level
  @translation = translation
  @indentation = indentation
end

Instance Attribute Details

#indentationObject (readonly)

Returns the value of attribute indentation.



241
242
243
# File 'lib/i18n_add/yaml_processor.rb', line 241

def indentation
  @indentation
end

#keyObject (readonly)

Returns the value of attribute key.



241
242
243
# File 'lib/i18n_add/yaml_processor.rb', line 241

def key
  @key
end

#levelObject (readonly)

Returns the value of attribute level.



241
242
243
# File 'lib/i18n_add/yaml_processor.rb', line 241

def level
  @level
end

#translationObject (readonly)

Returns the value of attribute translation.



241
242
243
# File 'lib/i18n_add/yaml_processor.rb', line 241

def translation
  @translation
end

Instance Method Details

#final_key?Boolean

Returns:

  • (Boolean)


250
251
252
# File 'lib/i18n_add/yaml_processor.rb', line 250

def final_key?
  @level == @translation.keys.size - 1
end