Class: NeetoTranslateCli::PayloadBuilder
- Inherits:
-
Object
- Object
- NeetoTranslateCli::PayloadBuilder
- Defined in:
- lib/neeto_translate_cli/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.
9 10 11 12 13 |
# File 'lib/neeto_translate_cli/payload_builder.rb', line 9 def initialize() = commit_id = git_commit_id @updated_keys = commit_id.empty? ? { frontend: [], backend: [] } : find_updated_keys(commit_id) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/neeto_translate_cli/payload_builder.rb', line 7 def end |
#updated_keys ⇒ Object (readonly)
Returns the value of attribute updated_keys.
7 8 9 |
# File 'lib/neeto_translate_cli/payload_builder.rb', line 7 def updated_keys @updated_keys end |
Instance Method Details
#no_new_changes?(payload) ⇒ Boolean
28 29 30 |
# File 'lib/neeto_translate_cli/payload_builder.rb', line 28 def no_new_changes?(payload) payload[:frontend][:missing_keys].values.all?(&:empty?) && payload[:backend][:missing_keys].values.all?(&:empty?) end |
#process! ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/neeto_translate_cli/payload_builder.rb', line 15 def process! { frontend: { en: en_json_flattened, missing_keys: find_missing_keys_for(:frontend) }, backend: { en: en_yml_flattened, missing_keys: find_missing_keys_for(:backend) }, metadata: { repo: [:repo], frontend: [:frontend], backend: [:backend], branch: [:branch] } } end |