Class: MisterBin::DocoptMaker

Inherits:
Object
  • Object
show all
Includes:
Colsole, Singleton
Defined in:
lib/mister_bin/docopt_maker.rb

Overview

This singleton class is responsible for generating a text string ready to be used by Docopt.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDocoptMaker

Returns a new instance of DocoptMaker.



15
16
17
# File 'lib/mister_bin/docopt_maker.rb', line 15

def initialize
  reset
end

Instance Attribute Details

#examplesObject (readonly)

Returns the value of attribute examples.



12
13
14
# File 'lib/mister_bin/docopt_maker.rb', line 12

def examples
  @examples
end

#helpObject

Returns the value of attribute help.



13
14
15
# File 'lib/mister_bin/docopt_maker.rb', line 13

def help
  @help
end

#optionsObject (readonly)

Returns the value of attribute options.



12
13
14
# File 'lib/mister_bin/docopt_maker.rb', line 12

def options
  @options
end

#paramsObject (readonly)

Returns the value of attribute params.



12
13
14
# File 'lib/mister_bin/docopt_maker.rb', line 12

def params
  @params
end

#usagesObject (readonly)

Returns the value of attribute usages.



12
13
14
# File 'lib/mister_bin/docopt_maker.rb', line 12

def usages
  @usages
end

#versionObject

Returns the value of attribute version.



13
14
15
# File 'lib/mister_bin/docopt_maker.rb', line 13

def version
  @version
end

Instance Method Details

#docoptObject



28
29
30
31
# File 'lib/mister_bin/docopt_maker.rb', line 28

def docopt
  [help_string, usage_string, options_string, 
    params_string, examples_string].compact.join "\n"
end

#resetObject



19
20
21
22
23
24
25
26
# File 'lib/mister_bin/docopt_maker.rb', line 19

def reset
  @usages = []
  @options = []
  @params = []
  @examples = []
  @version = '0.0.0'
  @help = nil
end