Class: Rack::Mount::Utils::Capture

Inherits:
Array
  • Object
show all
Defined in:
lib/rack/mount/utils.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Capture

Returns a new instance of Capture.



47
48
49
50
51
52
53
54
55
56
# File 'lib/rack/mount/utils.rb', line 47

def initialize(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}

  @name = options.delete(:name)
  @name = @name.to_s if @name

  @optional = options.delete(:optional) || false

  super(args)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



44
45
46
# File 'lib/rack/mount/utils.rb', line 44

def name
  @name
end

#optionalObject (readonly) Also known as: optional?

Returns the value of attribute optional.



44
45
46
# File 'lib/rack/mount/utils.rb', line 44

def optional
  @optional
end

Instance Method Details

#==(obj) ⇒ Object



58
59
60
# File 'lib/rack/mount/utils.rb', line 58

def ==(obj)
  @name == obj.name && @optional == obj.optional && super
end

#freezeObject



71
72
73
74
# File 'lib/rack/mount/utils.rb', line 71

def freeze
  each { |e| e.freeze }
  super
end

#named?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/rack/mount/utils.rb', line 67

def named?
  name && name != ''
end

#optionalize!Object



62
63
64
65
# File 'lib/rack/mount/utils.rb', line 62

def optionalize!
  @optional = true
  self
end