Class: Calrom::Highlighter::Selective
- Inherits:
-
Object
- Object
- Calrom::Highlighter::Selective
- Defined in:
- lib/calrom/highlighter/selective.rb
Instance Method Summary collapse
- #colour(text, colour) ⇒ Object
-
#initialize(selected, highlighter) ⇒ Selective
constructor
A new instance of Selective.
- #rank(text, rank) ⇒ Object
- #today(text) ⇒ Object
Constructor Details
#initialize(selected, highlighter) ⇒ Selective
Returns a new instance of Selective.
4 5 6 7 |
# File 'lib/calrom/highlighter/selective.rb', line 4 def initialize(selected, highlighter) @selected = selected @highlighter = highlighter end |
Instance Method Details
#colour(text, colour) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/calrom/highlighter/selective.rb', line 9 def colour(text, colour) if @selected.include? __method__ @highlighter.public_send __method__, text, colour else text end end |
#rank(text, rank) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/calrom/highlighter/selective.rb', line 17 def rank(text, rank) if @selected.include? __method__ @highlighter.public_send __method__, text, rank else text end end |
#today(text) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/calrom/highlighter/selective.rb', line 25 def today(text) if @selected.include? __method__ @highlighter.public_send __method__, text else text end end |