Class: TomParse::Option

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

Overview

Encapsulate a named parameter.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, description = '') ⇒ Option

Create new Argument object.

Parameters:

  • name

    name of option

  • description (defaults to: '')

    option description



16
17
18
19
# File 'lib/tomparse/option.rb', line 16

def initialize(name, description = '')
  @name = name.to_s.intern
  @description = description
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



9
10
11
# File 'lib/tomparse/option.rb', line 9

def description
  @description
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/tomparse/option.rb', line 7

def name
  @name
end

Instance Method Details

#required?Boolean

Is this a required option?

Returns:

  • (Boolean)

    Boolean.



24
25
26
# File 'lib/tomparse/option.rb', line 24

def required?
  @description.downcase.include? 'required'
end