class Voom::Presenters::DSL::Components::Grid
Attributes
color[R]
columns[R]
gutter[R]
height[R]
padding[R]
wide[R]
Public Class Methods
new(color: nil, **attribs_, &block)
click to toggle source
Calls superclass method
Voom::Presenters::DSL::Components::EventBase::new
# File lib/voom/presenters/dsl/components/grid.rb, line 19 def initialize(color: nil, **attribs_, &block) super(type: :grid, **attribs_, &block) @columns = [] @color = color padding = attribs.delete(:padding) {nil} @padding = validate_padding(coerce_padding(padding, default_level: 3)).uniq if padding != nil @wide = attribs.delete(:wide) {false} @gutter = coerce_gutter(attribs.delete(:gutter) {nil}) @height = attribs.delete(:height) {nil} expand! end
Public Instance Methods
column(size, color: nil, **attribs, &block)
click to toggle source
# File lib/voom/presenters/dsl/components/grid.rb, line 31 def column(size, color: nil, **attribs, &block) attribs = size.respond_to?(:keys) ? attribs.merge(size) : attribs.merge(size: size) @columns << Column.new(parent: self, color: color, **attribs, &block) end
Private Instance Methods
coerce_gutter(gutter)
click to toggle source
# File lib/voom/presenters/dsl/components/grid.rb, line 39 def coerce_gutter(gutter) case gutter when true, :full, :all true when false, :none false when nil nil else raise Errors::ParameterValidation, "Grid gutter was: #{gutter}. "\ 'Allowed gutter values are true, false, :full, :all, :none! and nil' end end