Class: Comet::Binding

Inherits:
Object
  • Object
show all
Defined in:
lib/comet-html/parser-binding.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(el, parent, key, value) ⇒ Binding

Returns a new instance of Binding.



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/comet-html/parser-binding.rb', line 24

def initialize el, parent, key, value
  @el     = el
  @parent = parent

  @attribute_name   = key.delete_suffix(".bind")
  @is_cpp           = attribute_name.start_with?("cpp::")
  @attribute_name   = attribute_name[5..-1] if is_cpp
  @code, @bind_mode = extract_bind_mode_from value

  if @parent.find_reference_for(el).nil?
    @parent.refs << (Reference.new(el, @parent))
  end
end

Instance Attribute Details

#attribute_nameObject (readonly)

Returns the value of attribute attribute_name.



22
23
24
# File 'lib/comet-html/parser-binding.rb', line 22

def attribute_name
  @attribute_name
end

#bind_modeObject (readonly)

Returns the value of attribute bind_mode.



22
23
24
# File 'lib/comet-html/parser-binding.rb', line 22

def bind_mode
  @bind_mode
end

#codeObject (readonly)

Returns the value of attribute code.



22
23
24
# File 'lib/comet-html/parser-binding.rb', line 22

def code
  @code
end

#elObject (readonly)

Returns the value of attribute el.



22
23
24
# File 'lib/comet-html/parser-binding.rb', line 22

def el
  @el
end

#is_cppObject (readonly)

Returns the value of attribute is_cpp.



22
23
24
# File 'lib/comet-html/parser-binding.rb', line 22

def is_cpp
  @is_cpp
end

Instance Method Details

#binds_to_cpp_property?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/comet-html/parser-binding.rb', line 38

def binds_to_cpp_property?
  @is_cpp
end