little_wheels 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/little_wheels.rb +33 -7
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7366ace87bb341e2c4bfb019995eb3a167d3226827e13c0f281627e4766df1c8
4
- data.tar.gz: c036705390e96b03ad3da97a058a074f8e8cd4203c76c61577f6a2e46cad3a06
3
+ metadata.gz: 0e5a89103fef26ef5663ad1f7cfd215865f67863dabe703e9e50454f32edba48
4
+ data.tar.gz: 3c633c615464ab951210f5dde9156f59577ab625932bd5abcacbc6fcc5b5fe5d
5
5
  SHA512:
6
- metadata.gz: f354ab4ede76e3c7c22a47a7fd32fc7b13c2912227a7fd0c1a2fe204b683642c8264d63f2406db4b99c7f124a3e6a8bb967ce8ab6bdc4cbf64ab21f28084de99
7
- data.tar.gz: 3b7f8431bf6aa8ab06a76b7e62696a2ad0e551c35934a9cfae889fdd8bb8eba1aabcecdd50ffd97ee4173861cba079f9fa503e164231c4f76ed5bac00c9377de
6
+ metadata.gz: 83b59a0c1929aca554daaea53c164878df50ba600133c96f7f40c3a11cdcbdc6164ebbbe14a04ee2aea0c3aa30ab6a26bf024f1b186eb061d690ee97112dde0a
7
+ data.tar.gz: 4495c71f386fb712b41f8540d3bc21c13b12094638ac6d39d7d7d7fdeaac326cc527ea54dad179a0b4522100c5684de930f27c1f0617712fcde06ab69d4f7a61
data/lib/little_wheels.rb CHANGED
@@ -1,7 +1,21 @@
1
1
  module LittleWheels
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
 
4
- class Component
4
+ class Buffer
5
+ def initialize(string)
6
+ @string = string.html_safe
7
+ end
8
+
9
+ def +(other)
10
+ self.class.new(@string + other.to_s)
11
+ end
12
+
13
+ def to_s
14
+ @string
15
+ end
16
+ end
17
+
18
+ module Component
5
19
  def t(template, **locals)
6
20
  renderer.render(inline: template, locals:)
7
21
  end
@@ -9,21 +23,33 @@ module LittleWheels
9
23
  def t!(template, **locals)
10
24
  renderer.render(template, locals:, layout: nil)
11
25
  end
12
-
26
+
13
27
  def x
14
- renderer.helpers.tag
28
+ helpers.tag
29
+ end
30
+
31
+ def o(&block)
32
+ block.binding.receiver.capture(&block)
15
33
  end
16
34
 
35
+ def +(other)
36
+ Buffer.new(to_s + other.to_s)
37
+ end
38
+
17
39
  def to_s
18
- renderer.helpers.capture do
40
+ helpers.capture do
19
41
  if self.class.const_defined?(:TEMPLATE)
20
42
  t(self.class.const_get(:TEMPLATE), c: self, x: self.x )
21
43
  else
22
- t!("shared/#{default_template_name}", c: self, x: self.x )
44
+ t!(default_template_name, c: self, x: self.x )
23
45
  end
24
46
  end
25
47
  end
26
48
 
49
+ def helpers
50
+ renderer.helpers
51
+ end
52
+
27
53
  def accepts_slot(block)
28
54
  @_slot = block
29
55
  end
@@ -39,7 +65,7 @@ module LittleWheels
39
65
  end
40
66
 
41
67
  def default_template_name
42
- self.class.name.underscore
68
+ "shared/#{self.class.name.underscore}"
43
69
  end
44
70
 
45
71
  def capture(&block)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: little_wheels
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Brown
@@ -38,7 +38,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
40
  requirements: []
41
- rubygems_version: 3.1.2
41
+ rubygems_version: 3.5.9
42
42
  signing_key:
43
43
  specification_version: 4
44
44
  summary: Little Wheels!