Module: Ykutils::Gridlist
- Defined in:
- lib/ykutils/gridlist.rb
Constant Summary collapse
- TAMPLETES =
{ GRID_DEF: { TEMPLATE: %( .g-<%= row %>-<%= colum %> { grid-row-start: <%= row %>; grid-row-end: ,<%= row + 1 %>; grid-column-start: <%= colum %>; grid-column-end: <%= colum + 1 %>; } ), OBJ: nil } }.freeze
Class Method Summary collapse
- .make_grid(template_hash, scope, min_row, max_row, min_colum, max_colum) ⇒ Object
- .make_grid_list(min_row, max_row, min_colum, max_colum) ⇒ Object
- .make_grid_list_x(min_row, max_row, min_colum, max_colum) ⇒ Object
- .make_one_grid(hash, row, colum) ⇒ Object
Class Method Details
.make_grid(template_hash, scope, min_row, max_row, min_colum, max_colum) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ykutils/gridlist.rb', line 21 def make_grid(template_hash, scope, min_row, max_row, min_colum, max_colum) (min_row..max_row).map do |row| (min_colum..max_colum).map do |colum| # puts "#{row} #{colum}" value_hash = { row: row, colum: colum } # make_one_grid(template_hash, value_hash) # p template_hash # p value_hash Ykutils::Erubyx.erubi_render(template_hash, scope, value_hash) end end end |
.make_grid_list(min_row, max_row, min_colum, max_colum) ⇒ Object
34 35 36 37 38 |
# File 'lib/ykutils/gridlist.rb', line 34 def make_grid_list(min_row, max_row, min_colum, max_colum) template_hash = TAMPLETES[:GRID_DEF] scope = nil make_grid(template_hash, scope, min_row, max_row, min_colum, max_colum) end |
.make_grid_list_x(min_row, max_row, min_colum, max_colum) ⇒ Object
40 41 42 43 44 |
# File 'lib/ykutils/gridlist.rb', line 40 def make_grid_list_x(min_row, max_row, min_colum, max_colum) template_hash = TAMPLETES[:GRID_DEF] scope = nil make_grid(template_hash, scope, min_row, max_row, min_colum, max_colum) end |
.make_one_grid(hash, row, colum) ⇒ Object
16 17 18 19 |
# File 'lib/ykutils/gridlist.rb', line 16 def make_one_grid(hash, row, colum) hash[:OBJ] = Tilt::ErubiTemplate.new { hash[:TEMPLATE] } unless hash[:OBJ] hash[:OBJ].render(Object.new, { row: row, colum: colum }) end |