Module: HybookHelper

Defined in:
lib/hybook/helpers/misc.rb,
lib/hybook/helpers/markdown.rb

Overview

todo: change to Hybook::NumberHelper - why? why not??

Instance Method Summary collapse

Instance Method Details

#columns_begin(opts = {}) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/hybook/helpers/markdown.rb', line 24

def columns_begin( opts={} )
  # note: will add  columns2 or columns3 etc. depending on columns option passed in

  ## note: default was 2 (columns) for world.db, 300 (px) for beer.db
  columns = opts[:columns] || 300

  "\n<div class='columns#{columns}' markdown='1'>\n\n"
end

#columns_endObject



33
34
35
# File 'lib/hybook/helpers/markdown.rb', line 33

def columns_end
  "\n</div>\n\n"
end


19
20
21
# File 'lib/hybook/helpers/markdown.rb', line 19

def link_to( title, link )
  "[#{title}](#{link})"
end

#number_with_delimiter(num) ⇒ Object

todo:

add to textutils ?? why? why not??


10
11
12
13
# File 'lib/hybook/helpers/misc.rb', line 10

def number_with_delimiter( num )
  delimiter = '.'
  num.to_s.reverse.gsub( /(\d{3})(?=\d)/, "\\1#{delimiter}").reverse
end