Class: RipperTags::JSONFormatter
Instance Attribute Summary
#options
Instance Method Summary
collapse
#check_supported_flags, #constant?, #display_inheritance, #display_kind, #extra_flag?, #field?, #format, #initialize, #relative_path, #stdout?, #supported_fields, #tag_file_dir
Instance Method Details
12
13
14
15
|
# File 'lib/ripper-tags/json_formatter.rb', line 12
def stream_format?
return @stream_format if defined? @stream_format
@stream_format = ('s')
end
|
#supported_flags ⇒ Object
10
|
# File 'lib/ripper-tags/json_formatter.rb', line 10
def supported_flags() ['s'] end
|
#with_output ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/ripper-tags/json_formatter.rb', line 17
def with_output
super do |true_out|
buffer = []
yield buffer
if stream_format?
buffer.each { |tag| true_out.puts ::JSON.dump(tag) }
else
true_out.write ::JSON.dump(buffer)
end
end
end
|
#write(tag, buffer) ⇒ Object
30
31
32
|
# File 'lib/ripper-tags/json_formatter.rb', line 30
def write(tag, buffer)
buffer << tag
end
|