Class: Mnemosyne::Registry::Registration

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/mnemosyne/registry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(class_name, require_paths, probe) ⇒ Registration

Returns a new instance of Registration.



12
13
14
15
16
# File 'lib/mnemosyne/registry.rb', line 12

def initialize(class_name, require_paths, probe)
  @class_name = class_name
  @require_paths = Array(require_paths)
  @probe = probe
end

Instance Attribute Details

#class_name ⇒ Object (readonly)

Returns the value of attribute class_name.



10
11
12
# File 'lib/mnemosyne/registry.rb', line 10

def class_name
  @class_name
end

#require_paths ⇒ Object (readonly)

Returns the value of attribute require_paths.



10
11
12
# File 'lib/mnemosyne/registry.rb', line 10

def require_paths
  @require_paths
end

Instance Method Details

#installable? ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
26
27
# File 'lib/mnemosyne/registry.rb', line 18

def installable?
  return true unless class_name

  begin
    Module.const_get(class_name).is_a?(Class) ||
      Module.const_get(class_name).is_a?(Module)
  rescue NameError
    false
  end
end