class RShade::Formatter::Html
Constants
- FILE_NAME
- TEMPLATE
Attributes
event_store[R]
formatter[R]
Public Class Methods
new(event_store, args={})
click to toggle source
# File lib/rshade/formatter/html.rb, line 8 def initialize(event_store, args={}) @event_store = event_store @formatter = args.fetch(:formatter, Json) end
Public Instance Methods
call()
click to toggle source
# File lib/rshade/formatter/html.rb, line 13 def call data = formatter.call(event_store) erb_template = ERB.new(template) content = erb_template.result_with_hash({json: data.to_json}) write_to_file(content) end
template()
click to toggle source
# File lib/rshade/formatter/html.rb, line 26 def template @template ||=::File.read(::File.join(::RShade.config.root_dir, TEMPLATE)) end
write_to_file(data)
click to toggle source
# File lib/rshade/formatter/html.rb, line 20 def write_to_file(data) ::File.open(::File.join(RShade.config.store_dir, FILE_NAME), "w+") do |f| f.write data end end