Class: AwesomePrint::Formatters::LycraAttributeFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- AwesomePrint::Formatters::LycraAttributeFormatter
- Defined in:
- lib/awesome_print/formatters/lycra_attribute_formatter.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#inspector ⇒ Object
readonly
Returns the value of attribute inspector.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#padding ⇒ Object
readonly
Returns the value of attribute padding.
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(attribute, inspector, padding: 0) ⇒ LycraAttributeFormatter
constructor
TODO mappings (maybe refactor attribute(s) to accept the document and behave differently if they’re a document attribute or not).
Constructor Details
#initialize(attribute, inspector, padding: 0) ⇒ LycraAttributeFormatter
TODO mappings (maybe refactor attribute(s) to accept the document and behave differently if they’re a document attribute or not)
8 9 10 11 12 13 |
# File 'lib/awesome_print/formatters/lycra_attribute_formatter.rb', line 8 def initialize(attribute, inspector, padding: 0) @attribute = attribute @inspector = inspector @options = inspector. @padding = padding end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
4 5 6 |
# File 'lib/awesome_print/formatters/lycra_attribute_formatter.rb', line 4 def attribute @attribute end |
#inspector ⇒ Object (readonly)
Returns the value of attribute inspector.
4 5 6 |
# File 'lib/awesome_print/formatters/lycra_attribute_formatter.rb', line 4 def inspector @inspector end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/awesome_print/formatters/lycra_attribute_formatter.rb', line 4 def @options end |
#padding ⇒ Object (readonly)
Returns the value of attribute padding.
4 5 6 |
# File 'lib/awesome_print/formatters/lycra_attribute_formatter.rb', line 4 def padding @padding end |
Instance Method Details
#format ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/awesome_print/formatters/lycra_attribute_formatter.rb', line 15 def format if [:multiline] [ name_and_type, indent + (' ' * (padding + 1)) + description, #indent + (' ' * (padding + 1)) + mappings ].join("\n") else "#{name_and_type} #{description}" #{mappings}" end end |