Class: EY::Serverside::Callbacks::Hooks::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/engineyard-serverside/callbacks/hooks/base.rb

Direct Known Subclasses

App, Service

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ Base

Returns a new instance of Base.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/engineyard-serverside/callbacks/hooks/base.rb', line 11

def initialize(file_path)
  @path = Pathname.new(file_path)

  filename = path.basename

  callback = filename.basename('.rb')

  @flavor = filename == callback ? :executable : :ruby

  @callback_name = callback.to_s.to_sym
end

Instance Attribute Details

#callback_nameObject (readonly)

Returns the value of attribute callback_name.



9
10
11
# File 'lib/engineyard-serverside/callbacks/hooks/base.rb', line 9

def callback_name
  @callback_name
end

#flavorObject (readonly)

Returns the value of attribute flavor.



9
10
11
# File 'lib/engineyard-serverside/callbacks/hooks/base.rb', line 9

def flavor
  @flavor
end

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/engineyard-serverside/callbacks/hooks/base.rb', line 9

def path
  @path
end

Instance Method Details

#matches?(callback) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/engineyard-serverside/callbacks/hooks/base.rb', line 23

def matches?(callback)
  callback_name == callback
end

#readObject



27
28
29
# File 'lib/engineyard-serverside/callbacks/hooks/base.rb', line 27

def read
  path.read
end

#short_nameObject



35
36
37
# File 'lib/engineyard-serverside/callbacks/hooks/base.rb', line 35

def short_name
  raise "Unimplemented"
end

#to_sObject



31
32
33
# File 'lib/engineyard-serverside/callbacks/hooks/base.rb', line 31

def to_s
  raise "Unimplemented"
end