Module: GitStats::Inspector
- Included in:
- Generator, GitData::Author, GitData::Blob, GitData::Commit, GitData::Repo, StatsView::View
- Defined in:
- lib/git_stats/inspector.rb
Instance Method Summary collapse
Instance Method Details
#inspect ⇒ Object
19 20 21 |
# File 'lib/git_stats/inspector.rb', line 19 def inspect to_s end |
#pretty_print(pp) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/git_stats/inspector.rb', line 23 def pretty_print(pp) pp.object_address_group(self) do pp.seplist(defined_ivars, proc { pp.text(',') }) do |attr_name| pp.breakable(' ') pp.group(1) do pp.text(attr_name.to_s) pp.text('=') if ivars_to_be_filtered.include?(attr_name) pp.text('...') else pp.pp(instance_variable_get(attr_name)) end end end end end |
#to_s ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/git_stats/inspector.rb', line 5 def to_s vars = defined_ivars.map do |sym| value = if ivars_to_be_filtered.include?(sym) '...' else var = instance_variable_get(sym) var.is_a?(String) ? %("#{var}") : var.inspect end [sym, value].join('=') end vars = vars.join(', ').presence "#<#{[self.class, vars].compact.join(' ')}>" end |