Class: Obviews::ExposedAssigns
- Inherits:
-
Hash
- Object
- Hash
- Obviews::ExposedAssigns
- Defined in:
- lib/obviews/exposed_assigns.rb
Instance Method Summary collapse
-
#initialize(object, exposed_methods) ⇒ ExposedAssigns
constructor
A new instance of ExposedAssigns.
- #inspect ⇒ Object
- #keys ⇒ Object
Constructor Details
#initialize(object, exposed_methods) ⇒ ExposedAssigns
Returns a new instance of ExposedAssigns.
3 4 5 6 7 8 9 10 |
# File 'lib/obviews/exposed_assigns.rb', line 3 def initialize object, exposed_methods @exposed_methods = exposed_methods super() do |assigns, key| if @exposed_methods.include? key.to_sym assigns[key] = object.send(key) end end end |
Instance Method Details
#inspect ⇒ Object
16 17 18 |
# File 'lib/obviews/exposed_assigns.rb', line 16 def inspect "#<#{self.class}: @exposed_methods: (#{@exposed_methods.inspect}), hash: #{super}>" end |
#keys ⇒ Object
12 13 14 |
# File 'lib/obviews/exposed_assigns.rb', line 12 def keys super + @exposed_methods end |