Class: DayoneToolbox::API::AddEntry

Inherits:
Base
  • Object
show all
Defined in:
lib/dayone_toolbox/api.rb

Instance Attribute Summary

Attributes inherited from Base

#cli_exit_code, #entry, #result

Instance Method Summary collapse

Methods inherited from Base

#initialize, #store

Constructor Details

This class inherits a constructor from DayoneToolbox::API::Base

Instance Method Details

#execObject



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/dayone_toolbox/api.rb', line 61

def exec
  hash = {}
  @options.each do |k, v|
    current_value = @entry.send("#{k}")
    set_value = current_value << v
    set_value.flatten! if set_value.class == Array
    @entry.send("#{k}=", set_value)
    hash.merge!({"#{k}" => set_value})
  end
  @result = hash
  self
end