Class: Clip::Flag

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

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(short, long, options) ⇒ Flag

nodoc



314
315
316
317
318
# File 'lib/clip.rb', line 314

def initialize(short, long, options)
  @short = short
  @long = long
  @description = options[:desc]
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



310
311
312
# File 'lib/clip.rb', line 310

def description
  @description
end

#longObject

Returns the value of attribute long.



310
311
312
# File 'lib/clip.rb', line 310

def long
  @long
end

#shortObject

Returns the value of attribute short.



310
311
312
# File 'lib/clip.rb', line 310

def short
  @short
end

Instance Method Details

#has_default?Boolean

Returns:

  • (Boolean)


328
329
330
# File 'lib/clip.rb', line 328

def has_default?
  false
end

#process(parser, value) ⇒ Object



320
321
322
# File 'lib/clip.rb', line 320

def process(parser, value)
  parser.send("flag_#{@long}".to_sym)
end

#required?Boolean

Returns:

  • (Boolean)


324
325
326
# File 'lib/clip.rb', line 324

def required?
  false
end

#usageObject



332
333
334
# File 'lib/clip.rb', line 332

def usage
  sprintf('-%-2s --%-10s %s', @short, @long, @description)
end