Class: Hanami::View::DecoratedAttributes::Attributes Private
- Defined in:
- lib/hanami/view/decorated_attributes.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #decorate(*names, **options) ⇒ Object private
-
#initialize ⇒ Attributes
constructor
private
A new instance of Attributes.
- #inspect ⇒ Object private
Constructor Details
#initialize ⇒ Attributes
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Attributes.
61 62 63 64 |
# File 'lib/hanami/view/decorated_attributes.rb', line 61 def initialize(*) @names = Set.new super end |
Instance Method Details
#decorate(*names, **options) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/hanami/view/decorated_attributes.rb', line 66 def decorate(*names, **) @names += names class_eval do names.each do |name| define_method name do attribute = super() if _rendering && attribute _rendering.part(name, attribute, **) else attribute end end end end end |
#inspect ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
84 85 86 |
# File 'lib/hanami/view/decorated_attributes.rb', line 84 def inspect %(#<#{self.class.name}#{@names.to_a.sort.inspect}>) end |