Class: Composer::Semver::Constraint::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/composer/semver/constraint/base.rb

Direct Known Subclasses

Constraint, EmptyConstraint, MultiConstraint

Instance Method Summary collapse

Instance Method Details

#match_specific?(provider) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


38
39
40
# File 'lib/composer/semver/constraint/base.rb', line 38

def match_specific?(provider)
  raise NotImplementedError
end

#matches?(provider) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/composer/semver/constraint/base.rb', line 25

def matches?(provider)
  unless provider.kind_of?(::Composer::Semver::Constraint::Base)
    raise ArgumentError,
          'The "provider" must be a subclass of Composer::Semver::Constraint::Base'
  end

  if provider.instance_of?(self.class)
    match_specific?(provider)
  else
    provider.matches?(self)
  end
end

#pretty_stringObject



20
21
22
23
# File 'lib/composer/semver/constraint/base.rb', line 20

def pretty_string
  return to_s unless @pretty_string
  @pretty_string
end

#pretty_string=(pretty_string) ⇒ Object



16
17
18
# File 'lib/composer/semver/constraint/base.rb', line 16

def pretty_string=(pretty_string)
  @pretty_string = pretty_string
end