inesita 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24e1e74a6386e14c9225fcabfaa17127c76d53cc
4
- data.tar.gz: a4998681da428e757e3dae8426950b67865a3458
3
+ metadata.gz: 458b9936036113bd22c7281e5540805eaf750859
4
+ data.tar.gz: 7863484c3dc1751231b3e0f3e2dee9b72e777a63
5
5
  SHA512:
6
- metadata.gz: 0f645ed65beca7c00137206005370c261db88668983c6f40e47f1f541faf979b8571569d66a9bd003888908f05133cc8b10ba101e890dcd05f987e70c45f4af8
7
- data.tar.gz: a1e72e22272cf9f659d41449e15b5e0fc9bc3e4bad9e24f266da0b24c36d7ba2d281b27b1b1fbfe41cbf750d434d9fd342cc7b7c3c4364a508551cb33c2b1a35
6
+ metadata.gz: 0da6474d7bd3f30e9c4e66c5d71614c29bd788c7e23cc0393b1a081c44a6a3816685452c52515aa6d5c6ce7017a04664e7846c0054a5f21652adb2451462f275
7
+ data.tar.gz: da1834d65e9c268644463ec5a86e4121249f9159989e98e47212be7b76814eba7a179a76a8b0c893d8d38c32c0e5286e868f2cc702b404287b1d79b5893bf73c
data/inesita.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'inesita'
3
- s.version = '0.0.9'
3
+ s.version = '0.0.10'
4
4
  s.authors = [ 'Michał Kalbarczyk' ]
5
5
  s.email = 'fazibear@gmail.com'
6
6
  s.homepage = 'http://github.com/fazibear/inesita'
@@ -3,11 +3,7 @@ require 'opal'
3
3
  require 'browser'
4
4
  require 'inesita'
5
5
 
6
- require 'components/navbar'
7
- require 'components/layout'
8
- require 'components/home'
9
- require 'components/welcome'
10
- require 'components/goodbye'
6
+ require_tree './components'
11
7
 
12
8
  $document.ready do
13
9
  Inesita::Application.new(
@@ -1,5 +1,6 @@
1
1
  class Goodbye
2
2
  include Inesita::Component
3
+
3
4
  def render
4
5
  div class: 'jumbotron text-center' do
5
6
  h1 do
@@ -1,5 +1,6 @@
1
1
  class Home
2
2
  include Inesita::Component
3
+
3
4
  def render
4
5
  div class: 'jumbotron text-center' do
5
6
  h1 do
@@ -1,7 +1,9 @@
1
1
  class Layout
2
2
  include Inesita::Layout
3
3
 
4
- component :navbar, NavBar.new
4
+ def initialize
5
+ component :navbar, NavBar.new
6
+ end
5
7
 
6
8
  def render
7
9
  div do
@@ -10,15 +10,11 @@ module Inesita
10
10
  @router = Router.new(options[:routes])
11
11
  @layout = options[:layout]
12
12
 
13
- if @layout
14
- self.class.component :layout_component, @layout.new(@router)
15
- else
16
- self.class.component :router_component, @router
17
- end
13
+ component :parent, @layout ? @layout.create(@router) : @router
18
14
  end
19
15
 
20
16
  def render
21
- component layout ? layout_component : router_component
17
+ component parent
22
18
  end
23
19
  end
24
20
  end
@@ -27,19 +27,13 @@ module Inesita
27
27
  `document.location.pathname`
28
28
  end
29
29
 
30
- def self.included(base)
31
- base.extend(ClassMethods)
32
- end
33
-
34
- module ClassMethods
35
- def component(name, instance)
36
- define_method name do
37
- unless instance_variable_get(:"@#{name}")
38
- instance_variable_set(:"@#{name}", instance)
39
- instance_variable_get(:"@#{name}").parent(self)
40
- end
41
- instance_variable_get(:"@#{name}")
30
+ def component(name, instance)
31
+ self.class.define_method name do
32
+ unless instance_variable_get(:"@#{name}")
33
+ instance_variable_set(:"@#{name}", instance)
34
+ instance_variable_get(:"@#{name}").parent(self)
42
35
  end
36
+ instance_variable_get(:"@#{name}")
43
37
  end
44
38
  end
45
39
  end
@@ -2,12 +2,15 @@ module Inesita
2
2
  module Layout
3
3
  def self.included(base)
4
4
  base.include(Component)
5
+ base.extend(ClassMethods)
5
6
  end
6
7
 
7
- attr_reader :outlet
8
-
9
- def initialize(outlet)
10
- self.class.component :outlet, outlet
8
+ module ClassMethods
9
+ def create(outlet)
10
+ new.tap do |l|
11
+ l.component :outlet, outlet
12
+ end
13
+ end
11
14
  end
12
15
  end
13
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inesita
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michał Kalbarczyk