Class: Kicker::Recipes::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/kicker/recipes/base.rb

Direct Known Subclasses

Rails

Defined Under Namespace

Classes: NotImplementedError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kicker, files) ⇒ Base

Returns a new instance of Base.



12
13
14
15
# File 'lib/kicker/recipes/base.rb', line 12

def initialize(kicker, files)
  @kicker, @files = kicker, files
  after_initialize if respond_to?(:after_initialize)
end

Instance Attribute Details

#filesObject (readonly)

Returns the value of attribute files.



10
11
12
# File 'lib/kicker/recipes/base.rb', line 10

def files
  @files
end

#kickerObject (readonly)

Returns the value of attribute kicker.



10
11
12
# File 'lib/kicker/recipes/base.rb', line 10

def kicker
  @kicker
end

Class Method Details

.call(kicker, files) ⇒ Object



6
7
8
# File 'lib/kicker/recipes/base.rb', line 6

def self.call(kicker, files)
  new(kicker, files).handle!
end

Instance Method Details

#handle!Object



17
18
19
# File 'lib/kicker/recipes/base.rb', line 17

def handle!
  raise NotImplementedError, 'The subclass should implement this method to handle the changed files.'
end

#relative_path(path) ⇒ Object



21
22
23
# File 'lib/kicker/recipes/base.rb', line 21

def relative_path(path)
  path[(Dir.pwd.length + 1)..-1]
end