Class: RShade::Formatter::Trace::Json

Inherits:
Object
  • Object
show all
Defined in:
lib/rshade/formatter/trace/json.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filepath:, pretty: false) ⇒ Json

Returns a new instance of Json.



9
10
11
12
# File 'lib/rshade/formatter/trace/json.rb', line 9

def initialize(filepath:, pretty: false)
  @filepath = filepath
  @pretty = pretty
end

Instance Attribute Details

#filepathObject (readonly)

Returns the value of attribute filepath.



7
8
9
# File 'lib/rshade/formatter/trace/json.rb', line 7

def filepath
  @filepath
end

#prettyObject (readonly)

Returns the value of attribute pretty.



7
8
9
# File 'lib/rshade/formatter/trace/json.rb', line 7

def pretty
  @pretty
end

Instance Method Details

#call(event_store) ⇒ Object

Parameters:



15
16
17
18
19
# File 'lib/rshade/formatter/trace/json.rb', line 15

def call(event_store)
  ::File.open(filepath, 'a+') do |file|
    file.puts(convert_to_json(flat(event_store), pretty))
  end
end