Class: Passpartu::Patcher

Inherits:
Object
  • Object
show all
Defined in:
lib/passpartu/patcher.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Patcher

Returns a new instance of Patcher.



6
7
8
# File 'lib/passpartu/patcher.rb', line 6

def initialize(klass)
  @klass = klass
end

Instance Attribute Details

#klassObject (readonly)

Returns the value of attribute klass.



5
6
7
# File 'lib/passpartu/patcher.rb', line 5

def klass
  @klass
end

Class Method Details

.call(klass) ⇒ Object



10
11
12
# File 'lib/passpartu/patcher.rb', line 10

def self.call(klass)
  new(klass).call
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
# File 'lib/passpartu/patcher.rb', line 14

def call
  klass.class_eval do
    define_method('can?') do |*keys|
      Passpartu::Verify.call(role, keys)
    end
  end
end