Class: Caty::GlobalOption

Inherits:
Option
  • Object
show all
Includes:
HasDescription
Defined in:
lib/caty/global_option.rb

Overview

Represents a single global option.

A GlobalOption object is created for every option specified via Caty::global_options(). The sum of all global options parsed is accessible via the Caty#global_options() method.

Instance Attribute Summary

Attributes included from HasDescription

#description

Attributes inherited from Option

#name

Instance Method Summary collapse

Methods included from HasDescription

#short_description

Methods inherited from Option

#grep!, #initialize

Constructor Details

This class inherits a constructor from Caty::Option

Instance Method Details

#to_helpObject

Returns a string representation to be used by the help system.



21
22
23
# File 'lib/caty/global_option.rb', line 21

def to_help
    [ self.to_s, self.short_description, self.description ]
end

#to_s(ljust = 0) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/caty/global_option.rb', line 25

def to_s( ljust = 0 )
    returning('') do |str|
        str << "#{self.prefix}#{@name}=#{
            @default.nil? ? '' : @default.inspect
        }".ljust(ljust)
    end
end