Class: Gem::Comparator::Report::Entry
- Inherits:
-
Object
- Object
- Gem::Comparator::Report::Entry
- Includes:
- UserInteraction
- Defined in:
- lib/rubygems/comparator/report/entry.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#indent ⇒ Object
Returns the value of attribute indent.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(data = '', indent = '') ⇒ Entry
constructor
A new instance of Entry.
- #print ⇒ Object
- #set_indent!(indent) ⇒ Object
Constructor Details
#initialize(data = '', indent = '') ⇒ Entry
Returns a new instance of Entry.
8 9 10 11 |
# File 'lib/rubygems/comparator/report/entry.rb', line 8 def initialize(data = '', indent = '') @data = data @indent = indent end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
6 7 8 |
# File 'lib/rubygems/comparator/report/entry.rb', line 6 def data @data end |
#indent ⇒ Object
Returns the value of attribute indent.
6 7 8 |
# File 'lib/rubygems/comparator/report/entry.rb', line 6 def indent @indent end |
Instance Method Details
#empty? ⇒ Boolean
18 19 20 21 22 23 |
# File 'lib/rubygems/comparator/report/entry.rb', line 18 def empty? case @data when String, Array @data.empty? end end |
#print ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rubygems/comparator/report/entry.rb', line 25 def print printed = case @data when String "#{@indent}#{@data}" when Array @indent + @data.join("\n#{@indent}") else "#{@indent}#{@data}" end say printed end |
#set_indent!(indent) ⇒ Object
13 14 15 16 |
# File 'lib/rubygems/comparator/report/entry.rb', line 13 def set_indent!(indent) @indent = indent self end |