Class: Todo::Options
- Inherits:
-
Object
- Object
- Todo::Options
- 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
-
#maintain_field_order ⇒ Boolean
PENDING.
-
#require_completed_on ⇒ Boolean
Require all done tasks to have a ‘completed_on` date.
Instance Method Summary collapse
-
#initialize ⇒ Options
constructor
A new instance of Options.
-
#reset ⇒ Object
Reset to defaults.
Constructor Details
#initialize ⇒ Options
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_order ⇒ Boolean
PENDING
Whether or not to preserve original field order for roundtripping.
27 28 29 |
# File 'lib/todo/options.rb', line 27 def maintain_field_order @maintain_field_order end |
#require_completed_on ⇒ Boolean
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
20 21 22 |
# File 'lib/todo/options.rb', line 20 def require_completed_on @require_completed_on end |
Instance Method Details
#reset ⇒ Object
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 |