Class: Calrom::Highlighter::Selective

Inherits:
Object
  • Object
show all
Defined in:
lib/calrom/highlighter/selective.rb

Instance Method Summary collapse

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