Module: UselessString::WithoutStarter

Included in:
String
Defined in:
lib/without_starter.rb

Instance Method Summary collapse

Instance Method Details

#cmp_without(other_str, options = {}) ⇒ Object



8
9
10
11
# File 'lib/without_starter.rb', line 8

def cmp_without(other_str, options = {})
  set_according_to_options(str = dup, other = other_str.dup, options)
  options[:case_insensitive] ? str.casecmp(other) : str <=> other
end

#eql_without?(other_str, options = {}) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
# File 'lib/without_starter.rb', line 3

def eql_without?(other_str, options = {})
  set_according_to_options(str = dup, other = other_str.dup, options)
  options[:case_insensitive] ? str.casecmp(other.upcase).zero? : str.eql?(other)
end