Class: Vident::Phlex::HTML
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- Vident::Phlex::HTML
- Includes:
- Component
- Defined in:
- lib/vident/phlex/html.rb
Class Attribute Summary collapse
-
.component_source_file_path ⇒ Object
Returns the value of attribute component_source_file_path.
Class Method Summary collapse
-
.attribute(name, **options) ⇒ Object
Phlex uses a DSL to define the document, and those methods could easily clash with our attribute accessors.
-
.current_component_modified_time ⇒ Object
Caching support.
- .inherited(subclass) ⇒ Object
Instance Method Summary collapse
-
#parent_element(**options) ⇒ Object
(also: #root)
Helper to create the main element.
Class Attribute Details
.component_source_file_path ⇒ Object
Returns the value of attribute component_source_file_path.
22 23 24 |
# File 'lib/vident/phlex/html.rb', line 22 def component_source_file_path @component_source_file_path end |
Class Method Details
.attribute(name, **options) ⇒ Object
Phlex uses a DSL to define the document, and those methods could easily clash with our attribute accessors. Therefore in Phlex components we do not create attribute accessors, and instead use instance variables directly.
17 18 19 20 |
# File 'lib/vident/phlex/html.rb', line 17 def attribute(name, **) [:delegates] = false super end |
.current_component_modified_time ⇒ Object
Caching support
25 26 27 28 29 |
# File 'lib/vident/phlex/html.rb', line 25 def current_component_modified_time path = component_source_file_path raise StandardError, "No component source file exists #{path}" unless path && ::File.exist?(path) ::File.mtime(path).to_i.to_s end |
.inherited(subclass) ⇒ Object
9 10 11 12 |
# File 'lib/vident/phlex/html.rb', line 9 def inherited(subclass) subclass.component_source_file_path = caller_locations(1, 10).reject { |l| l.label == "inherited" }[0].path super end |
Instance Method Details
#parent_element(**options) ⇒ Object Also known as: root
Helper to create the main element
33 34 35 |
# File 'lib/vident/phlex/html.rb', line 33 def parent_element(**) @parent_element ||= RootComponent.new(**parent_element_attributes()) end |