Module: Xqsr3::HashUtilities::KeyMatching

Defined in:
lib/xqsr3/hash_utilities/key_matching.rb

Overview

include-able module that provides ::has_match?, #has_match?, ::match, and #match methods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.has_match?(h, re, **options) ⇒ Boolean

Returns true if the hash h contains a key object that matches the given re, according to the given options

Returns:

  • (Boolean)


151
152
153
154
# File 'lib/xqsr3/hash_utilities/key_matching.rb', line 151

def self.has_match? h, re, **options

	Xqsr3::HashUtilities::KeyMatching.do_has_match_ h, re, **options
end

.match(h, re, **options) ⇒ Object

Retrieves the value object corresponding to the first key object that matches the given re, in the hash h, according to the given options.



144
145
146
147
# File 'lib/xqsr3/hash_utilities/key_matching.rb', line 144

def self.match h, re, **options

	Xqsr3::HashUtilities::KeyMatching.do_match_ h, re, **options
end

Instance Method Details

#has_match?(h, re, **options) ⇒ Boolean

Returns true if the hash h contains a key object that matches the given re, according to the given options

Returns:

  • (Boolean)


166
167
168
169
# File 'lib/xqsr3/hash_utilities/key_matching.rb', line 166

def has_match? h, re, **options

	Xqsr3::HashUtilities::KeyMatching.do_has_match_ h, re, **options
end

#match(h, re, **options) ⇒ Object

Retrieves the value object corresponding to the first key object that matches the given re, in the hash h, according to the given options.



159
160
161
162
# File 'lib/xqsr3/hash_utilities/key_matching.rb', line 159

def match h, re, **options

	Xqsr3::HashUtilities::KeyMatching.do_match_ h, re, **options
end