Class: Bemer::Entity
- Inherits:
-
Object
- Object
- Bemer::Entity
- Defined in:
- lib/bemer/entity.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#bem ⇒ Object
readonly
Returns the value of attribute bem.
-
#bem_cascade ⇒ Object
Returns the value of attribute bem_cascade.
-
#bem_class ⇒ Object
readonly
Returns the value of attribute bem_class.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#elem ⇒ Object
(also: #element)
readonly
Returns the value of attribute elem.
-
#js ⇒ Object
readonly
Returns the value of attribute js.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
- #attrs ⇒ Object
- #block? ⇒ Boolean
- #cls ⇒ Object
- #elem? ⇒ Boolean (also: #element?)
-
#initialize(block = '', element = nil, **options, &content) ⇒ Entity
constructor
A new instance of Entity.
- #mix ⇒ Object
- #mods ⇒ Object
Constructor Details
#initialize(block = '', element = nil, **options, &content) ⇒ Entity
13 14 15 16 17 18 19 20 21 |
# File 'lib/bemer/entity.rb', line 13 def initialize(block = '', element = nil, **, &content) @bem_class = Bemer.bem_class(block, element) @block = block @content = extract_content(.delete(:content), &content) @elem = element @name = Bemer.entity_name(block, element) () end |
Instance Attribute Details
#bem ⇒ Object (readonly)
Returns the value of attribute bem.
9 10 11 |
# File 'lib/bemer/entity.rb', line 9 def bem @bem end |
#bem_cascade ⇒ Object
Returns the value of attribute bem_cascade.
8 9 10 |
# File 'lib/bemer/entity.rb', line 8 def bem_cascade @bem_cascade end |
#bem_class ⇒ Object (readonly)
Returns the value of attribute bem_class.
9 10 11 |
# File 'lib/bemer/entity.rb', line 9 def bem_class @bem_class end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
9 10 11 |
# File 'lib/bemer/entity.rb', line 9 def block @block end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
9 10 11 |
# File 'lib/bemer/entity.rb', line 9 def content @content end |
#elem ⇒ Object (readonly) Also known as: element
Returns the value of attribute elem.
9 10 11 |
# File 'lib/bemer/entity.rb', line 9 def elem @elem end |
#js ⇒ Object (readonly)
Returns the value of attribute js.
9 10 11 |
# File 'lib/bemer/entity.rb', line 9 def js @js end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/bemer/entity.rb', line 9 def name @name end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
9 10 11 |
# File 'lib/bemer/entity.rb', line 9 def tag @tag end |
Instance Method Details
#attrs ⇒ Object
23 24 25 |
# File 'lib/bemer/entity.rb', line 23 def attrs @attrs ||= build_attrs(html_attrs) end |
#block? ⇒ Boolean
27 28 29 |
# File 'lib/bemer/entity.rb', line 27 def block? !element? end |
#cls ⇒ Object
31 32 33 |
# File 'lib/bemer/entity.rb', line 31 def cls @cls ||= build_css_classes(css_classes) end |
#elem? ⇒ Boolean Also known as: element?
35 36 37 |
# File 'lib/bemer/entity.rb', line 35 def elem? !elem.nil? end |
#mix ⇒ Object
41 42 43 |
# File 'lib/bemer/entity.rb', line 41 def mix @mix ||= mixins.to_a end |
#mods ⇒ Object
45 46 47 |
# File 'lib/bemer/entity.rb', line 45 def mods @mods ||= modifiers.to_h end |