Class: Emjay::Components::MjStyle

Inherits:
HeadComponent show all
Defined in:
lib/emjay/components/head/mj_style.rb

Instance Attribute Summary

Attributes inherited from Emjay::Component

#attributes, #context, #props

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from HeadComponent

#handler_children

Methods inherited from Emjay::Component

default_attributes, #get_attribute, #get_child_context, #get_content, #initialize, raw_element?

Constructor Details

This class inherits a constructor from Emjay::Component

Class Method Details

.allowed_attributesObject



16
17
18
# File 'lib/emjay/components/head/mj_style.rb', line 16

def self.allowed_attributes
  {"inline" => "string"}
end

.component_nameObject



8
9
10
# File 'lib/emjay/components/head/mj_style.rb', line 8

def self.component_name
  "mj-style"
end

.ending_tag?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/emjay/components/head/mj_style.rb', line 12

def self.ending_tag?
  true
end

Instance Method Details

#handlerObject



20
21
22
23
24
25
26
27
28
# File 'lib/emjay/components/head/mj_style.rb', line 20

def handler
  add = @context[:add]
  key = if get_attribute("inline") == "inline"
    :inline_style
  else
    :style
  end
  add.call(key, get_content)
end