Sha256: a553843fbca8095306ddf0f493c02144e3fc4f19107d5bdcb04bf1304d37630a

Contents?: true

Size: 787 Bytes

Versions: 7

Compression:

Stored size: 787 Bytes

Contents

require 'pathname'

module EY
  module Serverside
    module Callbacks
      module Hooks

        class Base
          attr_reader :path, :callback_name, :flavor

          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

          def matches?(callback)
            callback_name == callback
          end

          def read
            path.read
          end

          def to_s
            raise "Unimplemented"
          end

          def short_name
            raise "Unimplemented"
          end
        end

      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
engineyard-serverside-3.0.4 lib/engineyard-serverside/callbacks/hooks/base.rb
engineyard-serverside-3.0.3 lib/engineyard-serverside/callbacks/hooks/base.rb
engineyard-serverside-2.8.0 lib/engineyard-serverside/callbacks/hooks/base.rb
engineyard-serverside-2.8.0.pre4 lib/engineyard-serverside/callbacks/hooks/base.rb
engineyard-serverside-2.8.0.pre3 lib/engineyard-serverside/callbacks/hooks/base.rb
engineyard-serverside-2.8.0.pre2 lib/engineyard-serverside/callbacks/hooks/base.rb
engineyard-serverside-2.8.0.pre lib/engineyard-serverside/callbacks/hooks/base.rb