Class: CommitMsgUrlShortener::HookCode

Inherits:
Object
  • Object
show all
Defined in:
lib/commit-msg-url-shortener/hook_code.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(interpreter, code) ⇒ HookCode

Returns a new instance of HookCode.



4
5
6
7
# File 'lib/commit-msg-url-shortener/hook_code.rb', line 4

def initialize interpreter, code
  @interpreter = interpreter
  @code = code
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/commit-msg-url-shortener/hook_code.rb', line 3

def code
  @code
end

#interpreterObject (readonly)

Returns the value of attribute interpreter.



3
4
5
# File 'lib/commit-msg-url-shortener/hook_code.rb', line 3

def interpreter
  @interpreter
end

Class Method Details

.fabricate(path) ⇒ Object



9
10
11
12
13
# File 'lib/commit-msg-url-shortener/hook_code.rb', line 9

def self.fabricate path
  interpreter = File.basename(path).gsub(File.extname(path), '').downcase
  code = File.read(path).strip
  HookCode.new interpreter, code
end