Class: MarkyMarkdown::Helpers
- Inherits:
-
Object
- Object
- MarkyMarkdown::Helpers
- Defined in:
- lib/marky_markdown.rb
Class Method Summary collapse
- .count_occurences_for(key, body) ⇒ Object
- .shorten_str(str) ⇒ Object
- .split_str_by_returns(str) ⇒ Object
Class Method Details
.count_occurences_for(key, body) ⇒ Object
51 52 53 54 |
# File 'lib/marky_markdown.rb', line 51 def self.count_occurences_for(key, body) length = key.length body.count(key) / length end |
.shorten_str(str) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/marky_markdown.rb', line 37 def self.shorten_str(str) str.slice(str.index('#') + 1..(str.index('$') - 1)) rescue StandardError => e puts e. puts e.backtrace.inspect end |
.split_str_by_returns(str) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/marky_markdown.rb', line 44 def self.split_str_by_returns(str) str.split("\r\n") rescue StandardError => e puts e. puts e.backtrace.inspect end |