Module: GuardHelpers::MdHelper::ClassMethods
- Defined in:
- lib/ro_support/guard_helpers/md_helper.rb
Instance Method Summary collapse
- #anchor(name, url) ⇒ Object
- #get_name(title) ⇒ Object
- #h2(title) ⇒ Object
- #h3(title) ⇒ Object
- #l(title) ⇒ Object
- #l1(title) ⇒ Object
- #list(title, level = 0) ⇒ Object
- #ref(url) ⇒ Object
Instance Method Details
#anchor(name, url) ⇒ Object
10 11 12 |
# File 'lib/ro_support/guard_helpers/md_helper.rb', line 10 def anchor(name, url) "[#{name}](#{url})" end |
#get_name(title) ⇒ Object
23 24 25 |
# File 'lib/ro_support/guard_helpers/md_helper.rb', line 23 def get_name(title) title.split(" ").map(&:downcase).join("-") end |
#h2(title) ⇒ Object
14 15 16 |
# File 'lib/ro_support/guard_helpers/md_helper.rb', line 14 def h2(title) "##<a name='#{get_name(title)}'></a> #{title}" end |
#h3(title) ⇒ Object
18 19 20 |
# File 'lib/ro_support/guard_helpers/md_helper.rb', line 18 def h3(title) "###<a name='#{get_name(title)}'></a> #{title}" end |
#l(title) ⇒ Object
31 32 33 |
# File 'lib/ro_support/guard_helpers/md_helper.rb', line 31 def l (title) list(title) end |
#l1(title) ⇒ Object
35 36 37 |
# File 'lib/ro_support/guard_helpers/md_helper.rb', line 35 def l1 (title) list(title, 1) end |
#list(title, level = 0) ⇒ Object
39 40 41 42 |
# File 'lib/ro_support/guard_helpers/md_helper.rb', line 39 def list (title, level=0) ref = "##{title.split(" ").map(&:downcase).join("-")}" "#{" "*4*level}- [#{title}](#{ref})" end |
#ref(url) ⇒ Object
27 28 29 |
# File 'lib/ro_support/guard_helpers/md_helper.rb', line 27 def ref(url) "####[#{url}](#{url})" end |