bamboo 0.0.0 → 0.1.1
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 +4 -4
- data/README.md +4 -0
- data/lib/bamboo.rb +1 -4
- data/lib/bamboo/grid.rb +55 -0
- data/lib/bamboo/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fab7d70e3eaa367a68f56fa6b7e88a9767762b80
|
4
|
+
data.tar.gz: d1a9cb5f23f4011dccbf439875edfc7628273c8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32a3f3fe32e0e84b880a4cc1bcdf84b17a9874a9167ab612ea6a5405952c958ebff2fd11bc80c4939031139b531e9b7ce879a9f4f24091243f27e46b2f9dd1af
|
7
|
+
data.tar.gz: e9e38df569a8348b949c2f5686db2b86964cecbf06a0fa65edc9abab50b9f34e20d9b0301b2a4aac9e83a3fea9523d61d85c3cae15ce3e6d18029a0b6879ca30
|
data/README.md
CHANGED
@@ -30,6 +30,10 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
30
30
|
|
31
31
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
32
|
|
33
|
+
## To-Do
|
34
|
+
|
35
|
+
- Mobile-first, responsive grid
|
36
|
+
|
33
37
|
## Contributing
|
34
38
|
|
35
39
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bamboo.
|
data/lib/bamboo.rb
CHANGED
data/lib/bamboo/grid.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
module Bamboo
|
2
|
+
class Grid
|
3
|
+
def initialize(grid_width = 960, columns = 2)
|
4
|
+
@grid_width = grid_width
|
5
|
+
@columns = columns
|
6
|
+
end
|
7
|
+
|
8
|
+
# for 5 columns:
|
9
|
+
# arrangement => [2, 3]
|
10
|
+
def uniform(arrangement = [])
|
11
|
+
width = []
|
12
|
+
single = @grid_width / Float(@columns)
|
13
|
+
|
14
|
+
if arrangement.empty?
|
15
|
+
@columns.times do
|
16
|
+
width.push single
|
17
|
+
end
|
18
|
+
else
|
19
|
+
arrangement.each do |c|
|
20
|
+
width.push c * single
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
{ grid_width: @grid_width, column_widths: width, css: css(width) }
|
25
|
+
end
|
26
|
+
|
27
|
+
def golden_ratio
|
28
|
+
width = []
|
29
|
+
width_previous = @grid_width # Start with full grid
|
30
|
+
sum = 0
|
31
|
+
|
32
|
+
@columns.times do |i|
|
33
|
+
unless i == @columns - 1
|
34
|
+
width.push width_previous / 1.61803398875
|
35
|
+
width_previous = width_previous - width.last
|
36
|
+
sum = sum + width.last
|
37
|
+
else
|
38
|
+
width.push @grid_width - sum
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
{ grid_width: @grid_width, column_widths: width, css: css(width) }
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def css(columns)
|
48
|
+
css = ""
|
49
|
+
columns.each_with_index do |w,i|
|
50
|
+
css = css + ".col-#{i+1}{width:#{w}px}"
|
51
|
+
end
|
52
|
+
css
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/bamboo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bamboo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ashish Kumar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- bin/console
|
71
71
|
- bin/setup
|
72
72
|
- lib/bamboo.rb
|
73
|
+
- lib/bamboo/grid.rb
|
73
74
|
- lib/bamboo/version.rb
|
74
75
|
homepage: https://github.com/ashishkumar/bamboo
|
75
76
|
licenses:
|