class ComponentEmbeddedRuby::Node

Attributes

attributes[R]
children[R]
tag[R]

Public Class Methods

new(tag, attributes, children) click to toggle source
# File lib/component_embedded_ruby/node.rb, line 7
def initialize(tag, attributes, children)
  @tag = tag
  @attributes = attributes
  @children = children
end

Public Instance Methods

==(other) click to toggle source
# File lib/component_embedded_ruby/node.rb, line 13
def ==(other)
  if other
    other.tag == tag && other.attributes == attributes && other.children == children
  else
    false
  end
end
component?() click to toggle source

If the tag starts with a capital, we assume it's a component

# File lib/component_embedded_ruby/node.rb, line 26
def component?
  @_component ||= tag && !!/[[:upper:]]/.match(tag[0])
end
component_class() click to toggle source
# File lib/component_embedded_ruby/node.rb, line 21
def component_class
  @_component_class = Object.const_get(tag)
end
html?() click to toggle source
# File lib/component_embedded_ruby/node.rb, line 42
def html?
  !component? && tag
end
output_ruby?() click to toggle source
# File lib/component_embedded_ruby/node.rb, line 34
def output_ruby?
  ruby? && children.output
end
ruby?() click to toggle source
# File lib/component_embedded_ruby/node.rb, line 30
def ruby?
  children.is_a?(Eval)
end
text?() click to toggle source
# File lib/component_embedded_ruby/node.rb, line 38
def text?
  tag.nil? && !ruby?
end