Class: RGitHook::Plugin::OptionGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/rgithook/plugin.rb

Overview

::nodoc

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, description) ⇒ OptionGroup

Returns a new instance of OptionGroup.



19
20
21
22
# File 'lib/rgithook/plugin.rb', line 19

def initialize(name,description)
   @name,@description = name,description
   @options = []
end

Instance Attribute Details

#descriptionObject (readonly)

Todo: Make OptionGroup be an option of OptionGroup



17
18
19
# File 'lib/rgithook/plugin.rb', line 17

def description
  @description
end

#nameObject (readonly)

Todo: Make OptionGroup be an option of OptionGroup



17
18
19
# File 'lib/rgithook/plugin.rb', line 17

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



18
19
20
# File 'lib/rgithook/plugin.rb', line 18

def options
  @options
end

Instance Method Details

#option(name, desc, default, type) ⇒ Object



24
25
26
# File 'lib/rgithook/plugin.rb', line 24

def option(name,desc,default,type)
   @options << Option.new(name,desc,default,type)
end

#options_to_hashObject

Rertun a hash with default options



30
31
32
33
34
35
36
# File 'lib/rgithook/plugin.rb', line 30

def options_to_hash
   group_options = {}
   @options.each do |option|
      group_options[option.name]= option.default
   end
   group_options
end