Class: NeetoTranslateCli::NextI18next::PayloadBuilder
- Inherits:
-
Object
- Object
- NeetoTranslateCli::NextI18next::PayloadBuilder
- Defined in:
- lib/neeto_translate_cli/next_i18next/payload_builder.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#updated_keys ⇒ Object
readonly
Returns the value of attribute updated_keys.
Instance Method Summary collapse
-
#initialize(options) ⇒ PayloadBuilder
constructor
A new instance of PayloadBuilder.
- #no_new_changes?(payload) ⇒ Boolean
- #process! ⇒ Object
Constructor Details
#initialize(options) ⇒ PayloadBuilder
Returns a new instance of PayloadBuilder.
11 12 13 14 15 |
# File 'lib/neeto_translate_cli/next_i18next/payload_builder.rb', line 11 def initialize() @options = commit_id = git_commit_id @updated_keys = commit_id.empty? ? [] : find_updated_keys(commit_id) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/neeto_translate_cli/next_i18next/payload_builder.rb', line 9 def @options end |
#updated_keys ⇒ Object (readonly)
Returns the value of attribute updated_keys.
9 10 11 |
# File 'lib/neeto_translate_cli/next_i18next/payload_builder.rb', line 9 def updated_keys @updated_keys end |
Instance Method Details
#no_new_changes?(payload) ⇒ Boolean
32 33 34 |
# File 'lib/neeto_translate_cli/next_i18next/payload_builder.rb', line 32 def no_new_changes?(payload) payload[:frontend][:missing_keys].values.all?(&:empty?) end |
#process! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/neeto_translate_cli/next_i18next/payload_builder.rb', line 17 def process! { frontend: { en: flatten_hash_with_prefix(frontend_translations[:en]), missing_keys: find_missing_keys }, metadata: { repo: [:repo], frontend: [:frontend], strategy: [:strategy], branch: [:branch] } } end |