Class: RSpec::Covers::Declaration::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/covers/declaration.rb

Constant Summary collapse

METHOD_PATTERN =
/\A(.+)(#|\.)([^#.]+)\z/
GLOB_CHARS =
/[*?\[\]{}]/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Resolver

Returns a new instance of Resolver.



52
53
54
55
# File 'lib/rspec/covers/declaration.rb', line 52

def initialize(config)
  @config = config
  @unresolved = []
end

Instance Attribute Details

#unresolvedObject (readonly)

Returns the value of attribute unresolved.



50
51
52
# File 'lib/rspec/covers/declaration.rb', line 50

def unresolved
  @unresolved
end

Instance Method Details

#resolve(value) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/rspec/covers/declaration.rb', line 57

def resolve(value)
  case value
  when CodeRegion
    [value]
  when Module
    module_regions(value)
  when Regexp
    regexp_regions(value)
  when Symbol
    resolve(value.to_s)
  when String
    string_regions(value)
  else
    unresolved << value
    []
  end
end