class Systemized::Journal
Attributes
options[R]
unit[R]
Public Class Methods
new(unit, **options)
click to toggle source
# File lib/systemized/journal.rb, line 5 def initialize(unit, **options) @unit = unit @options = options self end
Public Instance Methods
arguments()
click to toggle source
# File lib/systemized/journal.rb, line 31 def arguments @arguments ||= [ "--unit #{unit}", ('--quiet' if quiet?), "--output #{output}", ('--utc' if utc?) ].compact.join(' ') end
command()
click to toggle source
# File lib/systemized/journal.rb, line 27 def command @command ||= options.fetch(:command) { 'journalctl' } end
lines()
click to toggle source
# File lib/systemized/journal.rb, line 23 def lines @lines ||= options.fetch(:lines) { 10 } end
output()
click to toggle source
# File lib/systemized/journal.rb, line 15 def output @output ||= options.fetch(:output) { 'short-iso' } end
quiet?()
click to toggle source
# File lib/systemized/journal.rb, line 11 def quiet? @quiet ||= options.fetch(:quiet) { true } end
read(entries = lines)
click to toggle source
# File lib/systemized/journal.rb, line 40 def read(entries = lines) `#{command} #{arguments} --lines #{entries}`.lines end
utc?()
click to toggle source
# File lib/systemized/journal.rb, line 19 def utc? @utc ||= options.fetch(:utc) { true } end