module MyFlexboxHelper
Public Instance Methods
grid(args = {})
click to toggle source
# File lib/flexbox_rb/my_flexbox_helper.rb, line 18 def grid args = {},&block [:xs,:sm,:md,:lg].each do |device| if args.has_key? device args[:class] = "#{args[:class]} col-#{device}-#{args[device]}" end end attrs = args.except!(:md,:lg,:xs,:sm).map {|k,v| "#{k}='#{v}' " }.join(" ") html_generator attrs, block end
html_generator(attrs_string, block)
click to toggle source
# File lib/flexbox_rb/my_flexbox_helper.rb, line 11 def html_generator attrs_string, block html= "<div #{attrs_string}>" \ "<div class='box'>" \ "#{capture(&block) unless block.nil?}" \ "</div></div>" html.html_safe end