Class: MSpecOption

Inherits:
Object show all
Defined in:
lib/mspec/utils/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(short, long, arg, description, block) ⇒ MSpecOption

Returns a new instance of MSpecOption


6
7
8
9
10
11
12
# File 'lib/mspec/utils/options.rb', line 6

def initialize(short, long, arg, description, block)
  @short       = short
  @long        = long
  @arg         = arg
  @description = description
  @block       = block
end

Instance Attribute Details

#argObject (readonly)

Returns the value of attribute arg


4
5
6
# File 'lib/mspec/utils/options.rb', line 4

def arg
  @arg
end

#blockObject (readonly)

Returns the value of attribute block


4
5
6
# File 'lib/mspec/utils/options.rb', line 4

def block
  @block
end

#descriptionObject (readonly)

Returns the value of attribute description


4
5
6
# File 'lib/mspec/utils/options.rb', line 4

def description
  @description
end

#longObject (readonly)

Returns the value of attribute long


4
5
6
# File 'lib/mspec/utils/options.rb', line 4

def long
  @long
end

#shortObject (readonly)

Returns the value of attribute short


4
5
6
# File 'lib/mspec/utils/options.rb', line 4

def short
  @short
end

Instance Method Details

#arg?Boolean

Returns:

  • (Boolean)

14
15
16
# File 'lib/mspec/utils/options.rb', line 14

def arg?
  @arg != nil
end

#match?(opt) ⇒ Boolean

Returns:

  • (Boolean)

18
19
20
# File 'lib/mspec/utils/options.rb', line 18

def match?(opt)
  opt == @short or opt == @long
end