Class: Society::Formatter::Report::Json
- Inherits:
-
Object
- Object
- Society::Formatter::Report::Json
- Defined in:
- lib/society/formatter/report/json.rb
Instance Attribute Summary collapse
-
#json_data ⇒ Object
readonly
Returns the value of attribute json_data.
-
#output_path ⇒ Object
readonly
Returns the value of attribute output_path.
Instance Method Summary collapse
-
#initialize(json_data:, output_path: nil) ⇒ Json
constructor
A new instance of Json.
- #write ⇒ Object
Constructor Details
#initialize(json_data:, output_path: nil) ⇒ Json
Returns a new instance of Json.
8 9 10 11 |
# File 'lib/society/formatter/report/json.rb', line 8 def initialize(json_data:, output_path: nil) @json_data = json_data @output_path = output_path end |
Instance Attribute Details
#json_data ⇒ Object (readonly)
Returns the value of attribute json_data.
6 7 8 |
# File 'lib/society/formatter/report/json.rb', line 6 def json_data @json_data end |
#output_path ⇒ Object (readonly)
Returns the value of attribute output_path.
6 7 8 |
# File 'lib/society/formatter/report/json.rb', line 6 def output_path @output_path end |
Instance Method Details
#write ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/society/formatter/report/json.rb', line 13 def write if output_path prepare_output_directory write_json_data else puts json_data end end |