Module: MyFlexboxHelper
- Defined in:
- lib/flexbox_rb/my_flexbox_helper.rb
Instance Method Summary collapse
Instance Method Details
#grid(args = {}, &block) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# 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) ⇒ Object
11 12 13 14 15 16 17 |
# 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 |