Top Level Namespace

Defined Under Namespace

Classes: Customization

Constant Summary collapse

CUSTOMIZATIONS =
[]
ICONV =
Iconv.new('UTF-8//IGNORE', 'UTF-8')

Instance Method Summary collapse

Instance Method Details

#apply_color(line) ⇒ Object



30
31
32
33
34
35
# File 'lib/stream_prettifier.rb', line 30

def apply_color(line)
    CUSTOMIZATIONS.each do |c|
        line = c.action.call(line) if line.match(c.regex)
    end
    line
end

#if_seen(regex, &action) ⇒ Object



21
22
23
# File 'lib/stream_prettifier.rb', line 21

def if_seen(regex, &action)
    CUSTOMIZATIONS << Customization.new(regex, action)
end

#load_user_preferencesObject



25
26
27
28
# File 'lib/stream_prettifier.rb', line 25

def load_user_preferences
    user_pref = File.join(Etc.getpwuid.dir, ".stream_prettifier")
    load user_pref if File.exists?(user_pref)
end