Class: TaskList

Inherits:
Object
  • Object
show all
Defined in:
lib/task_list.rb,
lib/task_list/filter.rb,
lib/task_list/railtie.rb,
lib/task_list/summary.rb,
lib/task_list/version.rb

Overview

encoding: utf-8

Defined Under Namespace

Classes: Filter, Item, Railtie, Summary

Constant Summary collapse

VERSION =
[1, 0, 2].join('.')

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record) ⇒ TaskList

‘record` is the resource with the Markdown source text with task list items following this syntax:

- [ ] a task list item
- [ ] another item
- [x] a completed item


15
16
17
# File 'lib/task_list.rb', line 15

def initialize(record)
  @record = record
end

Instance Attribute Details

#recordObject (readonly)

Returns the value of attribute record.



6
7
8
# File 'lib/task_list.rb', line 6

def record
  @record
end

Class Method Details

.asset_pathsObject



7
8
9
# File 'lib/task_list/railtie.rb', line 7

def self.asset_paths
  @paths ||= Dir[root_path.join("app/assets/*")]
end

.filter(*args) ⇒ Object

Returns a ‘Nokogiri::DocumentFragment` object.



7
8
9
# File 'lib/task_list/filter.rb', line 7

def self.filter(*args)
  Filter.call(*args)
end

.root_pathObject



3
4
5
# File 'lib/task_list/railtie.rb', line 3

def self.root_path
  @root_path ||= Pathname.new(File.expand_path("../../../", __FILE__))
end

Instance Method Details

#summaryObject

Public: return the TaskList::Summary for this task list.

Returns a TaskList::Summary.



22
23
24
# File 'lib/task_list.rb', line 22

def summary
  @summary ||= TaskList::Summary.new(record.task_list_items)
end