Class: Todo::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/todo/options.rb

Overview

Options for default preferences and library settings that can be customized by clients of the gem.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOptions

Returns a new instance of Options.



29
30
31
# File 'lib/todo/options.rb', line 29

def initialize
  reset
end

Instance Attribute Details

#maintain_field_orderBoolean

PENDING

Whether or not to preserve original field order for roundtripping.

Returns:

  • (Boolean)


27
28
29
# File 'lib/todo/options.rb', line 27

def maintain_field_order
  @maintain_field_order
end

#require_completed_onBoolean

Require all done tasks to have a ‘completed_on` date. True by default.

  • When ‘true`, tasks with invalid dates are considered not done.

  • When ‘false`, tasks starting with `x ` are considered done.

Example:

Todo.customize do |opts|
  opts.require_completed_on = false
end

task = Todo::Task.new("x This is done!")
task.done? # => true

Returns:

  • (Boolean)


20
21
22
# File 'lib/todo/options.rb', line 20

def require_completed_on
  @require_completed_on
end

Instance Method Details

#resetObject

Reset to defaults.



34
35
36
37
# File 'lib/todo/options.rb', line 34

def reset
  @require_completed_on = true
  @maintain_field_order = false
end