Class: TaskList::Item

Inherits:
Struct
  • Object
show all
Defined in:
lib/task_list.rb

Constant Summary collapse

Complete =

see TaskList::Filter

/\[[xX]\]/.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#checkbox_textObject

Returns the value of attribute checkbox_text

Returns:

  • (Object)

    the current value of checkbox_text



26
27
28
# File 'lib/task_list.rb', line 26

def checkbox_text
  @checkbox_text
end

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



26
27
28
# File 'lib/task_list.rb', line 26

def source
  @source
end

Instance Method Details

#complete?Boolean

Public: Check if a task list is complete.

Examples

Item.new("- [x]").complete?
# => true

Item.new("- [ ]").complete?
# => false

Returns true for checked list, false otherwise

Returns:

  • (Boolean)


40
41
42
# File 'lib/task_list.rb', line 40

def complete?
  !!(checkbox_text =~ Complete)
end