Sha256: 221858c3093b20c5ef12209ce89bc86f863e3b2171fbc90284d64f59d2a5d3ae

Contents?: true

Size: 677 Bytes

Versions: 2

Compression:

Stored size: 677 Bytes

Contents

# Lazy load HTML tag constants in the form DIV or A
# This is needed to allow for a HAML expression like this DIV.my_class
class Object
  class << self
    alias _reactrb_tag_original_const_missing const_missing

    def const_missing(const_name)
      # Opal uses const_missing to initially define things,
      # so we always call the original, and respond to the exception
      _reactrb_tag_original_const_missing(const_name)
    rescue StandardError => e
      React::Component::Tags.html_tag_class_for(const_name) || raise(e)
    end
  end

  def to_key
    object_id
  end
end

class Number
  def to_key
    self
  end
end

class Boolean
  def to_key
    self
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hyper-react-1.0.0.lap27 lib/react/object.rb
hyper-react-1.0.0.lap26 lib/react/object.rb