Class: TrackerDeliveries::FormatTools
- Inherits:
-
Object
- Object
- TrackerDeliveries::FormatTools
- Defined in:
- lib/format_tools.rb
Constant Summary collapse
- PIVOTAL_TRACKER_STORY_URL =
'https://pivotaltracker.com/story/show/'
Instance Method Summary collapse
- #html(s) ⇒ Object
-
#initialize(format) ⇒ FormatTools
constructor
A new instance of FormatTools.
- #markdown(s) ⇒ Object
- #pivotal_tracker_link(s) ⇒ Object
- #plaintext(s) ⇒ Object
- #story_formatter(s) ⇒ Object
- #wrap_output(output) ⇒ Object
Constructor Details
#initialize(format) ⇒ FormatTools
Returns a new instance of FormatTools.
5 6 7 |
# File 'lib/format_tools.rb', line 5 def initialize format @format = format end |
Instance Method Details
#html(s) ⇒ Object
31 32 33 34 |
# File 'lib/format_tools.rb', line 31 def html s link = %Q{<a href="#{pivotal_tracker_link s}">#{s.id}</a>} %Q{<li>#{link} - #{s.name}</li>} end |
#markdown(s) ⇒ Object
26 27 28 29 |
# File 'lib/format_tools.rb', line 26 def markdown s link = %Q{[#{s.id}](#{pivotal_tracker_link s})} %Q{- #{link} - #{s.name}} end |
#pivotal_tracker_link(s) ⇒ Object
9 10 11 |
# File 'lib/format_tools.rb', line 9 def pivotal_tracker_link s %Q{#{PIVOTAL_TRACKER_STORY_URL}#{s.id}} end |
#plaintext(s) ⇒ Object
22 23 24 |
# File 'lib/format_tools.rb', line 22 def plaintext s %Q{#{s.id} - #{s.name}} end |
#story_formatter(s) ⇒ Object
13 14 15 |
# File 'lib/format_tools.rb', line 13 def story_formatter s return send(@format, s) end |
#wrap_output(output) ⇒ Object
17 18 19 20 |
# File 'lib/format_tools.rb', line 17 def wrap_output output return %Q{<ul>\n#{output}\n</ul>} if @format == :html output end |