Class: RailsInfo::Logs::Test::Rspec
- Inherits:
-
Object
- Object
- RailsInfo::Logs::Test::Rspec
- Defined in:
- lib/rails_info/logs/test/rspec.rb
Defined Under Namespace
Classes: FilePresenter
Constant Summary collapse
- FILE_NAME_REGEXP =
/[a-zA-Z]|[0-9]|\/|\.|_|-|@/
Instance Method Summary collapse
- #hash ⇒ Object
-
#initialize(options = {log: {}, debug: false}) ⇒ Rspec
constructor
A new instance of Rspec.
- #number_of_files ⇒ Object
- #rails_root ⇒ Object
- #summary ⇒ Object
Constructor Details
#initialize(options = {log: {}, debug: false}) ⇒ Rspec
Returns a new instance of Rspec.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rails_info/logs/test/rspec.rb', line 4 def initialize( = {log: {}, debug: false}) ||= {log: {}, debug: false} [:log] ||= {} @rails_root = [:log][:rails_root] || Rails.root.to_s @body = [:log][:body] @show_all = [:log][:show_all] || false @debug = [:debug] unless @body file_path = "#{@rails_root}/log/rspec.log" @body = File.new(file_path, 'r').read if File.exist?(file_path) end @log ||= {} process if @body.present? end |
Instance Method Details
#hash ⇒ Object
28 29 30 |
# File 'lib/rails_info/logs/test/rspec.rb', line 28 def hash @log.keys.any? ? @log : (@body || ['']) end |
#number_of_files ⇒ Object
32 33 34 |
# File 'lib/rails_info/logs/test/rspec.rb', line 32 def number_of_files hash.is_a?(Hash) ? hash.keys.length : 0 end |
#rails_root ⇒ Object
36 37 38 |
# File 'lib/rails_info/logs/test/rspec.rb', line 36 def rails_root @rails_root end |
#summary ⇒ Object
24 25 26 |
# File 'lib/rails_info/logs/test/rspec.rb', line 24 def summary @summary end |