Class: Gitnesse::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/gitnesse/config.rb

Defined Under Namespace

Classes: ConfigStruct

Constant Summary collapse

@@config =

Config Options:

repository_url - URl to remote git-based wiki. features_dir - directory for local features. Defaults to “features” branch - git branch of remote git-based wiki to use. Defaults to

'master'

annotate_results - boolean, determines if Gitnesse will annotate cucumber

results to wiki pages. Defaults to false

identifier - if annotate_results is checked, an identifier to use

to indicate who ran the cukes.
e.g. "Uncle Bob's MacBook Air"
ConfigStruct.new

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object

Method_missing used to make it easier to access ConfigStruct values

Example:

@config = Gitnesse::Config.instance
@config.annotate_results #=> false


60
61
62
63
64
65
66
# File 'lib/gitnesse/config.rb', line 60

def method_missing(method, *args, &block)
  if @@config.respond_to?(method)
    @@config.send(method, *args, &block)
  else
    raise NoMethodError
  end
end

Class Method Details

.config {|@@config| ... } ⇒ Object

Allows external configuration of the ConfigStruct using a block.

Accepts a block for config options

Returns the current configuration

Example:

@config = Gitnesse::Config.instance

Gitnesse::Config.config do |config|
  config.annotate_results = true
end

@config.annotate_results #=> true

Yields:



43
44
45
46
# File 'lib/gitnesse/config.rb', line 43

def self.config
  yield @@config if block_given?
  Hash[@@config.each_pair.to_a]
end

Instance Method Details

#to_hObject

Converts the current configuration option to a hash

Returns a hash



51
52
53
# File 'lib/gitnesse/config.rb', line 51

def to_h
  Hash[@@config.each_pair.to_a]
end