Class: Covered::Policy::Autoload
- Inherits:
-
Object
- Object
- Covered::Policy::Autoload
- Defined in:
- lib/covered/policy.rb
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#initialize(name) ⇒ Autoload
constructor
A new instance of Autoload.
- #new ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name) ⇒ Autoload
Returns a new instance of Autoload.
97 98 99 |
# File 'lib/covered/policy.rb', line 97 def initialize(name) @name = name end |
Instance Method Details
#call(*args) ⇒ Object
113 114 115 |
# File 'lib/covered/policy.rb', line 113 def call(*args) self.new.call(*args) end |
#new ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/covered/policy.rb', line 101 def new begin klass = Covered.const_get(@name) rescue NameError require_relative @name.downcase end klass = Covered.const_get(@name) return klass.new end |
#to_s ⇒ Object
117 118 119 |
# File 'lib/covered/policy.rb', line 117 def to_s "\#<#{self.class} loading #{@name}>" end |