README.md in whirled_peas-0.1.1 vs README.md in whirled_peas-0.2.0
- old
+ new
@@ -128,11 +128,11 @@
WhirledPeas.template do |template, template_settings|
template_settings.bg_color = :blue
template.add_grid do |grid, grid_settings|
grid_settings.num_cols = 10
100.times do |i|
- grid.add_text { i.to_s }
+ grid.add_text { i }
end
end
end
```
@@ -140,11 +140,11 @@
```ruby
def number_grid(grid, settings)
settings.num_cols = 10
100.times do |i|
- grid.add_text { i.to_s }
+ grid.add_text { i }
end
end
WhirledPeas.template do |template, settings|
settings.bg_color = :blue
@@ -155,16 +155,16 @@
Additionally, if no child element is explicitly added to a `GridElement`, but the block returns an array of strings or numbers, those will be converted to `TextElements` and added as children to the `GridElement`. For example, these are identical ways to create a grid of strings
```ruby
template.add_grid do |g|
100.times do |i|
- g.add_text { i.to_s }
+ g.add_text { i }
end
end
template.add_grid do |g|
- 100.times.map(&:to_s)
+ 100.times.map(&:itself)
end
```
Similarly, if no child element is explicilty added to a `BoxElement`, but the block returns a string or number, that value will be converted to a `TextElement` and added as a child. For example, these are identical ways to create a box with string content
@@ -336,10 +336,10 @@
def number_grid(elem, settings)
settings.full_border
@numbers.each.with_index do |num, index|
g.add_text do |_, settings|
settings.bg_color = (@low == index || @high == index) ? :cyan : :white
- num.to_s
+ num
end
end
end
def body(elem, settings)