Module: Polyfill::V2_4::Symbol

Defined in:
lib/polyfill/v2_4/symbol.rb

Instance Method Summary collapse

Instance Method Details

#casecmp?(other) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
# File 'lib/polyfill/v2_4/symbol.rb', line 4

def casecmp?(other)
  return nil unless other.is_a?(::Symbol)

  casecmp(other) == 0
end

#match(*args) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/polyfill/v2_4/symbol.rb', line 10

def match(*args)
  if block_given?
    to_s.match(*args, &::Proc.new)
  else
    to_s.match(*args)
  end
end

#match?(pattern, position = 0) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/polyfill/v2_4/symbol.rb', line 18

def match?(pattern, position = 0)
  !!(self[position..-1] =~ pattern)
end