BOBrb 0.1.0 → 0.1.2

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: 3afa5f5e8d8cdeb1eab0ffccb533cfc0c79855a4
4
- data.tar.gz: 807d159c23278dd86b22bf6e35f4e7048cb72b52
3
+ metadata.gz: ab7a6ae52bf8772deac68da697c9eca2ea3d941a
4
+ data.tar.gz: ad5497fc93dcfbdc0acd38c169deddaaf6a7dcc3
5
5
  SHA512:
6
- metadata.gz: 32ac4ef84bfce1b6aacc7221c065c055ead785644e9dce3334b8b9778f0f66e953331e01c5b9673186ee20d4eea15440322b70a78d4c1634c60868dad56a4dbe
7
- data.tar.gz: 5f5925f65fa6965683a1608400e1664b487092f52e2ea9fcd63bcfb1ac9bdddd925ecd162578b4d7e32fd91a2c669a4a9ddd0b55ae99b4b92429b42a2e25e18d
6
+ metadata.gz: 055881e431d9ec4b37f759e1866d66e5ee47be2678c09e6e4266bef0189de3a660a30beb7e463ff03d31c521b196add0105df96f774a17f33679da3c2efb91a3
7
+ data.tar.gz: e03703250ccb7930588049964b84b61ba5a49540f72b225752896a66c06041f93451e8b2c8441f37dde2abd0fcb0b3ff3fbf4a7526bdc7125a935135f7849bb9
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'BOB/version'
4
+ require 'BOBrb/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "BOBrb"
8
- spec.version = BOB::VERSION
8
+ spec.version = BOBrb::VERSION
9
9
  spec.authors = ["Stephan Nordnes Eriksen"]
10
10
  spec.email = ["stephanruler@gmail.com"]
11
11
 
data/README.md CHANGED
@@ -6,15 +6,16 @@ BOB is a simple and powerfull ruby pipe system for building complex XML and HTML
6
6
  [![Build Status](https://travis-ci.org/stephan-nordnes-eriksen/BOBrb.svg)](https://travis-ci.org/stephan-nordnes-eriksen/BOBrb)
7
7
  [![Code Climate](https://codeclimate.com/github/stephan-nordnes-eriksen/BOBrb/badges/gpa.svg)](https://codeclimate.com/github/stephan-nordnes-eriksen/BOBrb)
8
8
  [![Test Coverage](https://codeclimate.com/github/stephan-nordnes-eriksen/BOBrb/badges/coverage.svg)](https://codeclimate.com/github/stephan-nordnes-eriksen/BOBrb/coverage)
9
+ [![Gem Version](https://badge.fury.io/rb/BOBrb.svg)](https://badge.fury.io/rb/BOBrb)
9
10
 
10
11
  ##Install:
11
12
  ```ruby
12
13
 
13
- require "BOB"
14
+ require "BOBrb"
14
15
  ```
15
16
 
16
- ###Gem (currently unreleased)
17
- gem install BOB
17
+ ###Gem
18
+ gem install BOBrb
18
19
 
19
20
  ##Usage:
20
21
  BOB is a pipe system for generating html structures.
@@ -22,87 +23,87 @@ BOB is a pipe system for generating html structures.
22
23
  ###TL;DR
23
24
  ```ruby
24
25
 
25
- BOB.new("div").toString() #=> "<div></div>"
26
- BOB.new("div").s() #=> "<div></div>"
27
- BOB.new("div").classs("some_class").s() #=> "<div class=\"some_class\"></div>" #NOTICE CLASSS, with three "s"-es. This is because ruby has defined the .class method.
28
- BOB.new("div").id("some_id").s() #=> "<div id=\"some_id\"></div>"
29
- BOB.new("div.some_class").s() #=> "<div class=\"some_class\"></div>"
30
- BOB.new("div#some_id").s() #=> "<div id=\"some_id\"></div>"
31
- BOB.new("div").style("min-height: 10px;").s() #=> "<div style=\"min-height: 10px;\"></div>"
32
- BOB.new("h1").content("BOB is awesome! <3").s() #=> "<h1>BOB is awesome! <3</h1>"
33
- BOB.new("div", {"data-BOB-is-cool": "Yes it is", "data-very-cool": "indeed"}).s() #=> "<div data-BOB-is-cool="Yes it is" data-very-cool="indeed"></div>"
34
- BOB.new("div").append("span").s() #=> "<div></div><span></span>"
35
- BOB.new("div").prepend("span").s() #=> "<span></span><div></div>"
36
- BOB.new("div").insert("span").s() #=> "<div><span></span></div>"
37
- BOB.new("div").append("span").id("some_id").s() #=> "<div></div><span id=\"some_id\"></span>"
38
- BOB.new("div").append("span").up().id("some_id").s() #=> "<div id=\"some_id\"></div><span></span>"
39
- BOB.new("ul").do([1,2,3]).insert("li").content(BOB.data).s() #=> <ul><li>1</li><li>2</li><li>3</li></ul>
40
- data = [1,2,3]; BOB.new("ul").do(data).insert("li", {"data-property": BOB.data}).id(BOB.data).s() #=> <ul><li id="1" data-property="1"></li><li id="2" data-property="2"></li><li id="3" data-property="3"></li></ul>
41
- BOB.new("ul").do([1,2,3]).insert("li").up().id(BOB.data).s() //INVALID #=> The BOB.data will not be set and you will get the output of: "<ul><li></li><li></li><li></li></ul>".
42
- BOB.new("ul").do([1,2,3]).insert("li").content(lambda{return BOB.data() + 2}).s() #=> <ul><li>3</li><li>4</li><li>5</li></ul>
43
- data_modifier = lambda{return BOB.data() + 2}; BOB.new("ul").do([1,2,3]).insert("li").content(data_modifier).s() #=> <ul><li>3</li><li>4</li><li>5</li></ul>
26
+ BOBrb.new("div").toString() #=> "<div></div>"
27
+ BOBrb.new("div").s() #=> "<div></div>"
28
+ BOBrb.new("div").classs("some_class").s() #=> "<div class=\"some_class\"></div>" #NOTICE CLASSS, with three "s"-es. This is because ruby has defined the .class method.
29
+ BOBrb.new("div").id("some_id").s() #=> "<div id=\"some_id\"></div>"
30
+ BOBrb.new("div.some_class").s() #=> "<div class=\"some_class\"></div>"
31
+ BOBrb.new("div#some_id").s() #=> "<div id=\"some_id\"></div>"
32
+ BOBrb.new("div").style("min-height: 10px;").s() #=> "<div style=\"min-height: 10px;\"></div>"
33
+ BOBrb.new("h1").content("BOB is awesome! <3").s() #=> "<h1>BOB is awesome! <3</h1>"
34
+ BOBrb.new("div", {"data-BOB-is-cool": "Yes it is", "data-very-cool": "indeed"}).s() #=> "<div data-BOB-is-cool="Yes it is" data-very-cool="indeed"></div>"
35
+ BOBrb.new("div").append("span").s() #=> "<div></div><span></span>"
36
+ BOBrb.new("div").prepend("span").s() #=> "<span></span><div></div>"
37
+ BOBrb.new("div").insert("span").s() #=> "<div><span></span></div>"
38
+ BOBrb.new("div").append("span").id("some_id").s() #=> "<div></div><span id=\"some_id\"></span>"
39
+ BOBrb.new("div").append("span").up().id("some_id").s() #=> "<div id=\"some_id\"></div><span></span>"
40
+ BOBrb.new("ul").do([1,2,3]).insert("li").content(BOBrb.data).s() #=> <ul><li>1</li><li>2</li><li>3</li></ul>
41
+ data = [1,2,3]; BOBrb.new("ul").do(data).insert("li", {"data-property": BOBrb.data}).id(BOBrb.data).s() #=> <ul><li id="1" data-property="1"></li><li id="2" data-property="2"></li><li id="3" data-property="3"></li></ul>
42
+ BOBrb.new("ul").do([1,2,3]).insert("li").up().id(BOBrb.data).s() //INVALID #=> The BOBrb.data will not be set and you will get the output of: "<ul><li></li><li></li><li></li></ul>".
43
+ BOBrb.new("ul").do([1,2,3]).insert("li").content(lambda{return BOBrb.data() + 2}).s() #=> <ul><li>3</li><li>4</li><li>5</li></ul>
44
+ data_modifier = lambda{return BOBrb.data() + 2}; BOBrb.new("ul").do([1,2,3]).insert("li").content(data_modifier).s() #=> <ul><li>3</li><li>4</li><li>5</li></ul>
44
45
 
45
46
  //Shorthand syntax:
46
- BOB.new("div").i("img", {"src":"some.png"}).u().d([1,2,3]).i("p.number").co(BOB.d).s() #=> "<div><img src="some.png" /><p class="number">1</p><p class="number">2</p><p class="number">3</p></div>"
47
+ BOBrb.new("div").i("img", {"src":"some.png"}).u().d([1,2,3]).i("p.number").co(BOBrb.d).s() #=> "<div><img src="some.png" /><p class="number">1</p><p class="number">2</p><p class="number">3</p></div>"
47
48
  ```
48
49
  [Go to shorthand syntax section](#shorthand)
49
50
 
50
51
  ###Building a simple tag:
51
52
  ```ruby
52
53
 
53
- BOB.new("div").toString()
54
+ BOBrb.new("div").toString()
54
55
  #=> "<div></div>"
55
56
  ```
56
57
  You can also use the shorthand method "s". For a full list see [the shorthand section](#shorthand)
57
58
 
58
59
  ```ruby
59
60
 
60
- BOB.new("div").s()
61
+ BOBrb.new("div").s()
61
62
  #=> "<div></div>"
62
63
  ```
63
64
 
64
65
  ###Adding IDs and classes
65
66
  ```ruby
66
67
 
67
- BOB.new("div").classs("some_class").s()
68
+ BOBrb.new("div").classs("some_class").s()
68
69
  #=> "<div class=\"some_class\"></div>"
69
- BOB.new("div").id("some_id").s()
70
- #=> "<div id=\"some_class\"></div>"
70
+ BOBrb.new("div").id("some_id").s()
71
+ #=> "<div id=\"some_id\"></div>"
71
72
  ```
72
73
 
73
74
  This can also be done with the shorthand selector style:
74
75
  ```ruby
75
76
 
76
- BOB.new("div.some_class").s()
77
+ BOBrb.new("div.some_class").s()
77
78
  #=> "<div class=\"some_class\"></div>"
78
- BOB.new("div#some_id").s()
79
- #=> "<div id=\"some_class\"></div>"
79
+ BOBrb.new("div#some_id").s()
80
+ #=> "<div id=\"some_id\"></div>"
80
81
  ```
81
82
 
82
83
  ###Adding styles, content, and custom attributes
83
84
  ```ruby
84
85
 
85
- BOB.new("div").style("min-height: 10px;").s()
86
+ BOBrb.new("div").style("min-height: 10px;").s()
86
87
  #=> "<div style=\"min-height: 10px;\"></div>"
87
- BOB.new("h1").content("BOB is awesome! <3").s()
88
+ BOBrb.new("h1").content("BOB is awesome! <3").s()
88
89
  #=> "<h1>BOB is awesome! <3</h1>"
89
- BOB.new("div", {"data-BOB-is-cool": "Yes it is", "data-very-cool": "indeed"}).s()
90
+ BOBrb.new("div", {"data-BOB-is-cool": "Yes it is", "data-very-cool": "indeed"}).s()
90
91
  #=> "<div data-BOB-is-cool="Yes it is" data-very-cool="indeed"></div>"
91
92
  ```
92
93
 
93
94
  ###Building and appending/prepending tags:
94
95
  ```ruby
95
96
 
96
- BOB.new("div").append("span").s()
97
+ BOBrb.new("div").append("span").s()
97
98
  #=> "<div></div><span></span>"
98
- BOB.new("div").prepend("span").s()
99
+ BOBrb.new("div").prepend("span").s()
99
100
  #=> "<span></span><div></div>"
100
101
  ```
101
102
 
102
103
  ###Building with inserting tags:
103
104
  ```ruby
104
105
 
105
- BOB.new("div").insert("span").s()
106
+ BOBrb.new("div").insert("span").s()
106
107
  #=> "<div><span></span></div>"
107
108
  ```
108
109
 
@@ -111,7 +112,7 @@ When appending, prepending, or inserting you will effectively branch downwards,
111
112
 
112
113
  ```ruby
113
114
 
114
- BOB.new("div").append("span").id("some_id").s()
115
+ BOBrb.new("div").append("span").id("some_id").s()
115
116
  #=> "<div></div><span id=\"some_id\"></span>"
116
117
  ```
117
118
 
@@ -119,7 +120,7 @@ In this simlpe example we see that it is the `span` that receives the `id`, not
119
120
 
120
121
  ```ruby
121
122
 
122
- BOB.new("div").append("span").up().id("some_id").s()
123
+ BOBrb.new("div").append("span").up().id("some_id").s()
123
124
  #=> "<div id=\"some_id\"></div><span></span>"
124
125
  ```
125
126
 
@@ -140,39 +141,39 @@ To do such branching, without having to re-write all parts manually, you can use
140
141
 
141
142
  ```ruby
142
143
 
143
- BOB.new("ul").do([1,2,3]).insert("li").content(BOB.data).s()
144
+ BOBrb.new("ul").do([1,2,3]).insert("li").content(BOBrb.data).s()
144
145
  #=> <ul><li>1</li><li>2</li><li>3</li></ul>
145
146
  ```
146
147
 
147
- Here you see `BOB.data` which is a special variable which represend the individal data points when the chain in being executed. It can be used for anything within the scope of the `do`, eg.
148
+ Here you see `BOBrb.data` which is a special variable which represend the individal data points when the chain in being executed. It can be used for anything within the scope of the `do`, eg.
148
149
 
149
150
  ```ruby
150
151
 
151
152
  data = [1,2,3]
152
- BOB.new("ul").do(data).insert("li", {"data-property": BOB.data}).id(BOB.data).s()
153
+ BOBrb.new("ul").do(data).insert("li", {"data-property": BOBrb.data}).id(BOBrb.data).s()
153
154
  #=> <ul><li id="1" data-property="1"></li><li id="2" data-property="2"></li><li id="3" data-property="3"></li></ul>
154
155
  ```
155
156
 
156
- However, if you use the `up` command and go out of the scope of `do`, `BOB.data` might not work. The behaviour is undefined so errors and/or strange behaviour might occur. Eg:
157
+ However, if you use the `up` command and go out of the scope of `do`, `BOBrb.data` might not work. The behaviour is undefined so errors and/or strange behaviour might occur. Eg:
157
158
 
158
159
  ```ruby
159
160
 
160
- BOB.new("ul").do([1,2,3]).insert("li").up().id(BOB.data).s() //INVALID
161
- #=> The BOB.data will not be set and you will get the output of: "<ul><li></li><li></li><li></li></ul>".
161
+ BOBrb.new("ul").do([1,2,3]).insert("li").up().id(BOBrb.data).s() //INVALID
162
+ #=> The BOBrb.data will not be set and you will get the output of: "<ul><li></li><li></li><li></li></ul>".
162
163
  ```
163
164
 
164
- ###Processing data and BOB.data
165
- BOB.data is a function, so **you cannot manipulate `BOB.data` directly.**
165
+ ###Processing data and BOBrb.data
166
+ BOBrb.data is a function, so **you cannot manipulate `BOBrb.data` directly.**
166
167
 
167
- It is adviced to do the data manipulation prior to the `do` pipe. However it is possible to manipulate BOB.data inline like this:
168
+ It is adviced to do the data manipulation prior to the `do` pipe. However it is possible to manipulate BOBrb.data inline like this:
168
169
 
169
170
  ```ruby
170
171
 
171
- BOB.new("ul").do([1,2,3]).insert("li").content(lambda{return BOB.data() + 2}).s()
172
+ BOBrb.new("ul").do([1,2,3]).insert("li").content(lambda{return BOBrb.data() + 2}).s()
172
173
  #=> <ul><li>3</li><li>4</li><li>5</li></ul>
173
174
  //Or you can predefine a set of manipulations
174
- data_modifier = lambda{return BOB.data() + 2}
175
- BOB.new("ul").do([1,2,3]).insert("li").content(data_modifier).s()
175
+ data_modifier = lambda{return BOBrb.data() + 2}
176
+ BOBrb.new("ul").do([1,2,3]).insert("li").content(data_modifier).s()
176
177
  #=> <ul><li>3</li><li>4</li><li>5</li></ul>
177
178
  ```
178
179
 
@@ -183,24 +184,24 @@ Writing out these pipes can be tiresom if you are building big and complex struc
183
184
 
184
185
  Long Version | Short Version
185
186
  ------------ | -------------
186
- .insert | .i
187
- .append | .a
188
- .prepend | .p
189
- .content | .co
190
- .style | .st
191
- .classs | .cl
192
- .id | .id
193
- .style | .st
194
- .toString | .s
195
- .do | .d
196
- .up | .u
197
- BOB.data | BOB.d
187
+ .insert | .i
188
+ .append | .a
189
+ .prepend | .p
190
+ .content | .co
191
+ .style | .st
192
+ .classs | .cl
193
+ .id | .id
194
+ .style | .st
195
+ .toString | .s
196
+ .do | .d
197
+ .up | .u
198
+ BOBrb.data | BOBrb.d
198
199
 
199
200
  Now you can get tight and cozy syntax like this:
200
201
 
201
202
  ```ruby
202
203
 
203
- BOB.new("div").i("img", {"src":"some.png"}).u().d([1,2,3]).i("p.number").co(BOB.d).s()
204
+ BOBrb.new("div").i("img", {"src":"some.png"}).u().d([1,2,3]).i("p.number").co(BOBrb.d).s()
204
205
  #=> "<div><img src="some.png"></img><p class="number">1</p><p class="number">2</p><p class="number">3</p></div>"
205
206
  ```
206
207
 
@@ -210,16 +211,16 @@ Better examples coming
210
211
  ```ruby
211
212
 
212
213
  data = ["Team member1", "team member2", "team member3"]
213
- BOB.new("ul").do(data).insert("li.team").content(BOB.data).s()
214
+ BOBrb.new("ul").do(data).insert("li.team").content(BOBrb.data).s()
214
215
  #=> "<ul><li class="team">Team member1</li><li class="team">team member2</li><li class="team">team member3</li></ul>"
215
216
 
216
- BOB.new("div#wrapper").insert("div#searchbar").up().insert("footer").do(["team","contact","buy"]).insert("h2").content(BOB.data).s()
217
+ BOBrb.new("div#wrapper").insert("div#searchbar").up().insert("footer").do(["team","contact","buy"]).insert("h2").content(BOBrb.data).s()
217
218
  #=> "<div id="wrapper"><div id="searchbar"></div><footer><h2>team</h2><h2>contact</h2><h2>buy</h2></footer></div>"
218
219
 
219
- BOB.new("div#wrapper").insert("div#searchbar").up().insert("footer").do(["team","contact","buy"]).insert("h2",{"onclick": lambda{return ("alert('" + BOB.data() + "');") }}).content(BOB.data).s()
220
+ BOBrb.new("div#wrapper").insert("div#searchbar").up().insert("footer").do(["team","contact","buy"]).insert("h2",{"onclick": lambda{return ("alert('" + BOBrb.data() + "');") }}).content(BOBrb.data).s()
220
221
  #=> "<div id="wrapper"><div id="searchbar"></div><footer><h2 onclick="alert('team');">team</h2><h2 onclick="alert('contact');">contact</h2><h2 onclick="alert('buy');">buy</h2></footer></div>"
221
222
 
222
- BOB.new("div#wrapper").insert("div#searchbar").up().insert("footer").do(["team","contact","buy"]).insert("h2",{"onclick": lambda{return ("alert('" + BOB.data() + "');") }}).content(BOB.data).up().up().prepend("a",{"href": "http://www.google.com"}).content("google").s()
223
+ BOBrb.new("div#wrapper").insert("div#searchbar").up().insert("footer").do(["team","contact","buy"]).insert("h2",{"onclick": lambda{return ("alert('" + BOBrb.data() + "');") }}).content(BOBrb.data).up().up().prepend("a",{"href": "http://www.google.com"}).content("google").s()
223
224
  #=> "<a href="http://www.google.com">google</a><div id="wrapper"><div id="searchbar"></div><footer><h2 onclick="alert('team');">team</h2><h2 onclick="alert('contact');">contact</h2><h2 onclick="alert('buy');">buy</h2></footer></div>"
224
225
  ```
225
226
 
@@ -227,7 +228,7 @@ Better examples coming
227
228
  Please help contribute to this project. It is brand new, and there are probably loads of features that can be added.
228
229
 
229
230
  ###Planned features
230
- - Adding nested data-aquisition data, eg: BOB.new("div").do(["a", "b"]).do([1,2]).in("a").classs(BOB.data[0]).co(BOB.data[1])
231
+ - Adding nested data-aquisition data, eg: BOBrb.new("div").do(["a", "b"]).do([1,2]).in("a").classs(BOBrb.data[0]).co(BOBrb.data[1])
231
232
  #=> <div><a class="a">1</a><a class="a">2</a><a class="b">1</a><a class="b">2</a></div>
232
233
 
233
234
  ##License
data/lib/BOBrb.rb ADDED
@@ -0,0 +1,17 @@
1
+ require "BOBrb/version"
2
+ require "BOBrb/element"
3
+ require "BOBrb/child_array"
4
+
5
+ module BOBrb
6
+ # Your code goes here...
7
+ def self.new(*args)
8
+ BOBrb::Element.new(*args)
9
+ end
10
+
11
+ def self.data(*args)
12
+ BOBrb::Element.method(:data)
13
+ end
14
+ def self.d(*args)
15
+ BOBrb::Element.method(:d)
16
+ end
17
+ end
@@ -1,4 +1,4 @@
1
- module BOB
1
+ module BOBrb
2
2
  class ChildArray
3
3
  def initialize (dataset, parent)
4
4
  @dataset = dataset
@@ -6,13 +6,13 @@ module BOB
6
6
  @bobs = []
7
7
  end
8
8
 
9
- #No point in doing this on parent. Does not make sense to do ".do(data).id(BOB::Element.data)"
9
+ #No point in doing this on parent. Does not make sense to do ".do(data).id(BOBrb::Element.data)"
10
10
  def content (content)
11
11
  self.co(content)
12
12
  end
13
13
  def co (content)
14
14
  @dataset.each_with_index do |item, i|
15
- BOB::Element.data = item
15
+ BOBrb::Element.data = item
16
16
  @bobs[i].co(content) if @bobs[i]
17
17
  end
18
18
  return self
@@ -22,7 +22,7 @@ module BOB
22
22
  end
23
23
  def st (style)
24
24
  @dataset.each_with_index do |item, i|
25
- BOB::Element.data = item
25
+ BOBrb::Element.data = item
26
26
  @bobs[i].st(style) if @bobs[i]
27
27
  end
28
28
  return self
@@ -32,14 +32,14 @@ module BOB
32
32
  end
33
33
  def cl (object_class)
34
34
  @dataset.each_with_index do |item, i|
35
- BOB::Element.data = item
35
+ BOBrb::Element.data = item
36
36
  @bobs[i].cl(object_class) if @bobs[i]
37
37
  end
38
38
  return self
39
39
  end
40
40
  def id (object_id)
41
41
  @dataset.each_with_index do |item, i|
42
- BOB::Element.data = item
42
+ BOBrb::Element.data = item
43
43
  @bobs[i].id(object_id) if @bobs[i]
44
44
  end
45
45
  return self
@@ -49,7 +49,7 @@ module BOB
49
49
  end
50
50
  def i (data, options=nil)
51
51
  @dataset.each_with_index do |item, i|
52
- BOB::Element.data = item
52
+ BOBrb::Element.data = item
53
53
  if @bobs[i]
54
54
  @bobs[i] = @bobs[i].insert(data, options)
55
55
  else
@@ -64,7 +64,7 @@ module BOB
64
64
  end
65
65
  def a (data, options=nil)
66
66
  @dataset.each_with_index do |item, i|
67
- BOB::Element.data = item
67
+ BOBrb::Element.data = item
68
68
  if @bobs[i]
69
69
  @bobs[i] = @bobs[i].a(data, options)
70
70
  else
@@ -79,7 +79,7 @@ module BOB
79
79
  end
80
80
  def p (data, options=nil)
81
81
  @dataset.each_with_index do |item, i|
82
- BOB::Element.data = item
82
+ BOBrb::Element.data = item
83
83
  if @bobs[i]
84
84
  @bobs[i] = @bobs[i].p(data, options)
85
85
  else
@@ -117,7 +117,7 @@ module BOB
117
117
  end
118
118
  def d (data)
119
119
  for bob in @bobs
120
- BOB::Element.data = item
120
+ BOBrb::Element.data = item
121
121
  if @bobs[i]
122
122
  @bobs[i] = @bobs[i].d(data)
123
123
  else
@@ -132,14 +132,14 @@ module BOB
132
132
  end
133
133
  def u
134
134
  unless @bobs[0]
135
- BOB::Element.data = nil
135
+ BOBrb::Element.data = nil
136
136
  return @parent
137
137
  end
138
138
  [0...@bobs.length].each do |i|
139
139
  @bobs[i] = @bobs[i].u()
140
140
  end
141
141
  if @bobs[0] == @parent
142
- BOB::Element.data = nil
142
+ BOBrb::Element.data = nil
143
143
  return @parent
144
144
  else
145
145
  return self
@@ -1,7 +1,7 @@
1
1
  # BOB
2
2
 
3
3
  # build or bail
4
- module BOB
4
+ module BOBrb
5
5
  class Element
6
6
  attr_accessor :object_content, :parent
7
7
  @@data = nil
@@ -0,0 +1,3 @@
1
+ module BOBrb
2
+ VERSION = "0.1.2"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: BOBrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephan Nordnes Eriksen
@@ -77,8 +77,8 @@ files:
77
77
  - ".gitignore"
78
78
  - ".rspec"
79
79
  - ".travis.yml"
80
- - BOB.gemspec
81
80
  - BOB.png
81
+ - BOBrb.gemspec
82
82
  - CODE_OF_CONDUCT.md
83
83
  - Gemfile
84
84
  - Gemfile.lock
@@ -87,10 +87,10 @@ files:
87
87
  - Rakefile
88
88
  - bin/console
89
89
  - bin/setup
90
- - lib/BOB.rb
91
- - lib/BOB/child_array.rb
92
- - lib/BOB/element.rb
93
- - lib/BOB/version.rb
90
+ - lib/BOBrb.rb
91
+ - lib/BOBrb/child_array.rb
92
+ - lib/BOBrb/element.rb
93
+ - lib/BOBrb/version.rb
94
94
  homepage: https://github.com/stephan-nordnes-eriksen/BOBrb
95
95
  licenses:
96
96
  - MIT
data/lib/BOB.rb DELETED
@@ -1,17 +0,0 @@
1
- require "BOB/version"
2
- require "BOB/element"
3
- require "BOB/child_array"
4
-
5
- module BOB
6
- # Your code goes here...
7
- def self.new(*args)
8
- BOB::Element.new(*args)
9
- end
10
-
11
- def self.data(*args)
12
- BOB::Element.method(:data)
13
- end
14
- def self.d(*args)
15
- BOB::Element.method(:d)
16
- end
17
- end
data/lib/BOB/version.rb DELETED
@@ -1,3 +0,0 @@
1
- module BOB
2
- VERSION = "0.1.0"
3
- end