Class: OpenAPISourceTools::Ordering::KeyPattern

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi/sourcetools/order.rb

Overview

Book-keeping class for pattern and its location.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern, index, priority) ⇒ KeyPattern

Returns a new instance of KeyPattern.



140
141
142
143
144
# File 'lib/openapi/sourcetools/order.rb', line 140

def initialize(pattern, index, priority)
  @pattern = pattern
  @index = index
  @priority = priority
end

Instance Attribute Details

#indexObject (readonly)

Returns the value of attribute index.



138
139
140
# File 'lib/openapi/sourcetools/order.rb', line 138

def index
  @index
end

#patternObject (readonly)

Returns the value of attribute pattern.



138
139
140
# File 'lib/openapi/sourcetools/order.rb', line 138

def pattern
  @pattern
end

#priorityObject (readonly)

Returns the value of attribute priority.



138
139
140
# File 'lib/openapi/sourcetools/order.rb', line 138

def priority
  @priority
end

Instance Method Details

#any?Boolean

Returns:

  • (Boolean)


150
151
152
# File 'lib/openapi/sourcetools/order.rb', line 150

def any?
  @index != @priority
end

#match?(string) ⇒ Boolean

Returns:

  • (Boolean)


146
147
148
# File 'lib/openapi/sourcetools/order.rb', line 146

def match?(string)
  @pattern.match?(string)
end