class React::NativeLibrary

Public Class Methods

const_missing(name) click to toggle source
Calls superclass method
# File lib/react/native_library.rb, line 11
def self.const_missing(name)
  if renames_and_exclusions.has_key? name
    if native_name = renames_and_exclusions[name]
      native_name
    else
      super
    end
  else
    libraries.each do |library|
      native_name = "#{library}.#{name}"
      native_component = `eval(#{native_name})` rescue nil
      React::API.import_native_component(name, native_component) and return name if native_component and `native_component != undefined`
    end
    name
  end
end
exclude(*exclude_list) click to toggle source
# File lib/react/native_library.rb, line 49
def self.exclude(*exclude_list)
  renames_and_exclusions.merge(Hash[exclude_list.map {|k| [k, nil]}])
end
imports(library) click to toggle source
# File lib/react/native_library.rb, line 41
def self.imports(library)
  libraries << library
end
libraries() click to toggle source
# File lib/react/native_library.rb, line 7
def self.libraries
  @libraries ||= []
end
method_missing(n, *args, &block) click to toggle source
Calls superclass method
# File lib/react/native_library.rb, line 28
def self.method_missing(n, *args, &block)
  name = n
  if name =~ /_as_node$/
    node_only = true
    name = name.gsub(/_as_node$/, "")
  end
  unless name = const_get(name)
    return super
  end
  React::RenderingContext.build_or_render(node_only, name, *args, &block)
rescue
end
rename(rename_list={}) click to toggle source
# File lib/react/native_library.rb, line 45
def self.rename(rename_list={})
  renames_and_exclusions.merge!(rename_list.invert)
end
renames_and_exclusions() click to toggle source
# File lib/react/native_library.rb, line 3
def self.renames_and_exclusions
  @renames_and_exclusions ||= {}
end