Class: Ovto::Component

Inherits:
Object
  • Object
show all
Defined in:
lib/ovto/component.rb

Direct Known Subclasses

Middleware::Component, PureComponent

Defined Under Namespace

Classes: MoreThanOneNode

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wired_action_set, middleware_path = []) ⇒ Component

Returns a new instance of Component.



21
22
23
24
25
26
27
28
# File 'lib/ovto/component.rb', line 21

def initialize(wired_action_set, middleware_path=[])
  @wired_action_set = wired_action_set || WiredActionSet.dummy
  @middleware_path = middleware_path
  # Initialize here for the unit tests
  @vdom_stack = [[]]
  @components = []
  @components_index = 0
end

Class Method Details

.hash_to_js_obj(hash) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/ovto/component.rb', line 8

def self.hash_to_js_obj(hash)
  ret = `{}`
  hash.each do |k, v|
    `ret[k] = v`
  end
  ret
end

.middleware_nameObject

(internal) Defined for convenience



17
18
19
# File 'lib/ovto/component.rb', line 17

def self.middleware_name
  WiredActionSet::I_AM_APP_NOT_A_MIDDLEWARE
end

Instance Method Details

#renderObject



30
31
32
# File 'lib/ovto/component.rb', line 30

def render
  ''
end

#stateObject



34
35
36
# File 'lib/ovto/component.rb', line 34

def state
  @wired_action_set.app.state
end