Class: DayoneToolbox::API::Base

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, options = {}) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
13
# File 'lib/dayone_toolbox/api.rb', line 8

def initialize(file, options={})
  @file = file
  @entry = DayoneToolbox::Entry.new(@file)
  @options = options
  @result = nil
end

Instance Attribute Details

#cli_exit_codeObject (readonly)

Returns the value of attribute cli_exit_code.



7
8
9
# File 'lib/dayone_toolbox/api.rb', line 7

def cli_exit_code
  @cli_exit_code
end

#entryObject (readonly)

Returns the value of attribute entry.



7
8
9
# File 'lib/dayone_toolbox/api.rb', line 7

def entry
  @entry
end

#resultObject (readonly)

Returns the value of attribute result.



7
8
9
# File 'lib/dayone_toolbox/api.rb', line 7

def result
  @result
end

Instance Method Details

#store(path = @file) ⇒ Object



15
16
17
18
19
20
# File 'lib/dayone_toolbox/api.rb', line 15

def store(path = @file)
  File.open(path, 'w') do |f|
    f.puts @entry.to_plist
  end
  self
end