Class: Ovto::PureComponent
- Defined in:
- lib/ovto/pure_component.rb
Defined Under Namespace
Classes: StateIsNotAvailable
Instance Method Summary collapse
- #do_render(args, state) ⇒ Object
-
#initialize(*args) ⇒ PureComponent
constructor
A new instance of PureComponent.
- #state ⇒ Object
Methods inherited from Component
hash_to_js_obj, middleware_name, #render
Constructor Details
#initialize(*args) ⇒ PureComponent
Returns a new instance of PureComponent.
5 6 7 8 9 |
# File 'lib/ovto/pure_component.rb', line 5 def initialize(*args) super @prev_props = nil @cache = nil end |
Instance Method Details
#do_render(args, state) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/ovto/pure_component.rb', line 11 def do_render(args, state) return @cache if args == @prev_props @prev_props = args @cache = super end |
#state ⇒ Object
18 19 20 |
# File 'lib/ovto/pure_component.rb', line 18 def state raise StateIsNotAvailable, "Cannot use state in PureComponent" end |