Sha256: ab0602421c9ec4bc90c3d52604a7eee278ce201bf1920e4b991acd4fd59822da

Contents?: true

Size: 801 Bytes

Versions: 3

Compression:

Stored size: 801 Bytes

Contents

module LatoView
  class Layout::Block::Cell < Cell

    @@widths = VIEW_GRIDCLASS

    attr_accessor :content, :width, :custom_class

    def initialize(width: 'small-12 medium-12 large-12 xlarge-12', content: '',
                   custom_class: '')
      # save params
      @width = width
      @content = content
      @class = custom_class
      # check params
    end

    def show
      open + @content + close
    end

    # open new block
    def open(width: @width, custom_class: @class)
      "<div class='content-block column #{width} #{custom_class}'>"
    end

    # close block
    def close
      '</div>'
    end

    # check params
    private def check_params
      raise 'Block Cell: width value in not correct' unless (@width.to_s.split(' ') - @@widths).empty?
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lato_view-1.1.5 app/cells/lato_view/layout/block/cell.rb
lato_view-1.1.4 app/cells/lato_view/layout/block/cell.rb
lato_view-1.1.3 app/cells/lato_view/layout/block/cell.rb