Class: Well::Block

Inherits:
Object
  • Object
show all
Includes:
Component
Defined in:
lib/well/block.rb

Overview

Class representing a BEM block component.

Instance Attribute Summary

Attributes included from Component

#identifier

Instance Method Summary collapse

Methods included from Component

#element, #evaluate, #modified_identifier, #modifier, #other_classes, #output_buffer, #output_classes

Constructor Details

#initialize(tag_name, identifier, opts = {}) ⇒ Block

Returns a new instance of Block.

Parameters:

  • tag_name (Symbol)

    The name of the HTML element to build

  • identifier (String)

    The main CSS class which represents the role of the BEM block

  • opts (Hash) (defaults to: {})

13
14
15
# File 'lib/well/block.rb', line 13

def initialize(tag_name, identifier, opts = {})
  @tag_name, @identifier, @opts = tag_name, identifier, opts
end

Instance Method Details

#baseBlock

Since the block is the base element in BEM, this can only return

self.

Returns:


20
21
22
# File 'lib/well/block.rb', line 20

def base
  self
end

#compiled_identifierString

Builds CSS class representing BEM block component.

Returns:

  • (String)

26
27
28
# File 'lib/well/block.rb', line 26

def compiled_identifier
  identifier
end