Class: Demos::Demo::App
- Inherits:
-
Hokusai::Block
- Object
- Hokusai::Block
- Demos::Demo::App
- Defined in:
- ui/examples/foobar.rb
Overview
Entrypoint Block Nothing is special about this block - any block can be used as an entrypoint
NOTE: Scrollbars, panels, and other basic functions are also plain blocks
Instance Attribute Summary collapse
-
#posts ⇒ Object
methods can be accessed in computed props.
Attributes inherited from Hokusai::Block
Instance Method Summary collapse
-
#initialize(**args) ⇒ App
constructor
initializer override.
-
#key(entry) ⇒ Object
loop state can be passed to methods.
-
#on_mounted ⇒ Object
lifecycle hook ‘on_mounted` `before_updated` `after_updated` `on_destroy`.
Methods inherited from Hokusai::Block
#children, #children?, compile, computed, computed!, #draw, #draw_with, #dump, #emit, inject, inject!, #method_missing, mount, #on_resize, provide, provides, #render, style, styles_get, template, template_from_file, template_get, #update, use, uses
Constructor Details
#initialize(**args) ⇒ App
initializer override
191 192 193 194 195 |
# File 'ui/examples/foobar.rb', line 191 def initialize(**args) @posts = [] super end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Hokusai::Block
Instance Attribute Details
#posts ⇒ Object
methods can be accessed in computed props
188 189 190 |
# File 'ui/examples/foobar.rb', line 188 def posts @posts end |
Instance Method Details
#key(entry) ⇒ Object
loop state can be passed to methods
198 199 200 |
# File 'ui/examples/foobar.rb', line 198 def key(entry) entry.id end |
#on_mounted ⇒ Object
lifecycle hook ‘on_mounted` `before_updated` `after_updated` `on_destroy`
207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'ui/examples/foobar.rb', line 207 def on_mounted uri = URI("https://jsonplaceholder.typicode.com/posts") res = JSON.parse(Net::HTTP.get(uri), symbolize_names: true) self.posts = res.map { |json| PostEntry.new(json[:id], json[:title], json[:body]) }.freeze # can access details about this block # # get the node count puts node..node_count # show the ast puts dump end |