Class: Ansible::Ruby::Models::Task
- Defined in:
- lib/ansible/ruby/models/task.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#local_action ⇒ Object
:reek:Attribute - This is a simple flag.
Instance Method Summary collapse
Methods inherited from Base
attr_option, attr_options, attribute, #initialize, remove_existing_validations, validates
Constructor Details
This class inherits a constructor from Ansible::Ruby::Models::Base
Instance Attribute Details
#local_action ⇒ Object
:reek:Attribute - This is a simple flag
40 41 42 |
# File 'lib/ansible/ruby/models/task.rb', line 40 def local_action @local_action end |
Instance Method Details
#to_h ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/ansible/ruby/models/task.rb', line 46 def to_h result = super # Module gets referenced by name, may not have a module though mod_or_include = @inclusion ? :inclusion : :module flatten = result.delete(mod_or_include) || {} # Module traditionally goes right after name, so rebuilding hash new_result = { name: result.delete(:name) } if @local_action module_name = flatten.keys.first flatten = { local_action: { module: module_name.to_s }.merge(flatten[module_name]) } end new_result.merge! flatten result.each do |key, value| new_result[key] = value end new_result end |