Module: Yello::ToYaml
- Defined in:
- lib/yello/to_yaml.rb
Class Method Summary collapse
Class Method Details
.card(c) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/yello/to_yaml.rb', line 29 def card(c) if c.checklists && !c.checklists.empty? { c.name=>nil, 'desc'=>c.desc, 'checklists'=>c.checklists.map{|cl|checklist(cl)} } else c.name end end |
.checklist(cl) ⇒ Object
41 42 43 44 45 |
# File 'lib/yello/to_yaml.rb', line 41 def checklist(cl) { cl.name => cl.items } end |
.convert(lists) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/yello/to_yaml.rb', line 13 def convert(lists) {}.tap{|h| lists.each{|l| h[l.name] = list(l) } }.to_yaml end |
.list(l) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/yello/to_yaml.rb', line 21 def list(l) {}.tap{|h| h['cards'] = l.cards.map{|c| card(c) } } end |