Class: Mercurial::Hook

Inherits:
Object
  • Object
show all
Defined in:
lib/mercurial-ruby/hook.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository, name, value) ⇒ Hook

Returns a new instance of Hook.



7
8
9
10
11
# File 'lib/mercurial-ruby/hook.rb', line 7

def initialize(repository, name, value)
  @repository = repository
  @name = name
  @value = value
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/mercurial-ruby/hook.rb', line 5

def name
  @name
end

#repositoryObject (readonly)

Returns the value of attribute repository.



5
6
7
# File 'lib/mercurial-ruby/hook.rb', line 5

def repository
  @repository
end

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/mercurial-ruby/hook.rb', line 5

def value
  @value
end

Instance Method Details

#destroy!Object



17
18
19
# File 'lib/mercurial-ruby/hook.rb', line 17

def destroy!
  repository.config.delete_setting!('hooks', name)
end

#saveObject



13
14
15
# File 'lib/mercurial-ruby/hook.rb', line 13

def save
  repository.config.add_setting('hooks', name, value)
end