Class: Axel::Inspector
- Inherits:
-
Object
- Object
- Axel::Inspector
- Defined in:
- lib/axel/inspector.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#parens_params ⇒ Object
readonly
Returns the value of attribute parens_params.
Instance Method Summary collapse
- #class? ⇒ Boolean
-
#initialize(object, parens_params = [], attributes = []) ⇒ Inspector
constructor
A new instance of Inspector.
- #inspect ⇒ Object
Constructor Details
#initialize(object, parens_params = [], attributes = []) ⇒ Inspector
Returns a new instance of Inspector.
13 14 15 16 17 |
# File 'lib/axel/inspector.rb', line 13 def initialize(object, parens_params = [], attributes = []) self.object = object self.parens_params = hasherize parens_params self.attributes = hasherize attributes end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
11 12 13 |
# File 'lib/axel/inspector.rb', line 11 def attributes @attributes end |
#object ⇒ Object
Returns the value of attribute object.
9 10 11 |
# File 'lib/axel/inspector.rb', line 9 def object @object end |
#parens_params ⇒ Object
Returns the value of attribute parens_params.
10 11 12 |
# File 'lib/axel/inspector.rb', line 10 def parens_params @parens_params end |
Instance Method Details
#class? ⇒ Boolean
35 36 37 |
# File 'lib/axel/inspector.rb', line 35 def class? object.is_a?(Class) end |
#inspect ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/axel/inspector.rb', line 19 def inspect class_name.tap do |string| string << "(#{display_parens})" unless parens_params.empty? string << " #{display_attributes}" unless attributes.empty? unless class? string.prepend "#<" string << ">" end end end |