Class: Vident::Phlex::Core

Inherits:
Phlex::HTML
  • Object
show all
Defined in:
lib/vident/phlex/core.rb

Direct Known Subclasses

HTML

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.component_source_file_pathObject

Returns the value of attribute component_source_file_path.



12
13
14
# File 'lib/vident/phlex/core.rb', line 12

def component_source_file_path
  @component_source_file_path
end

Class Method Details

.current_component_modified_timeObject

Caching support

Raises:

  • (StandardError)


15
16
17
18
19
# File 'lib/vident/phlex/core.rb', line 15

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



7
8
9
10
# File 'lib/vident/phlex/core.rb', line 7

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



23
24
25
# File 'lib/vident/phlex/core.rb', line 23

def parent_element(**options)
  @parent_element ||= ::Vident::Phlex::RootComponent.new(**parent_element_attributes(options))
end