Module: Filigree

Defined in:
lib/filigree/match.rb,
lib/filigree/types.rb,
lib/filigree/version.rb,
lib/filigree/visitor.rb,
lib/filigree/commands.rb,
lib/filigree/application.rb,
lib/filigree/configuration.rb,
lib/filigree/abstract_class.rb,
lib/filigree/class_methods_module.rb

Overview

Classes and Modules #

Defined Under Namespace

Modules: AbstractClass, Application, ClassMethodsModule, Commands, Configuration, Destructurable, TypedClass, Visitable, Visitor Classes: BasicPattern, BindingPattern, DestructuringPattern, InstancePattern, LiteralPattern, MatchEnvironment, MultipleObjectPattern, OuterPattern, RegexpPattern, SingleObjectPattern, TourGuide, WildcardPattern

Constant Summary collapse

VERSION =
'0.3.2'

Class Method Summary collapse

Class Method Details

.wrap_pattern_elements(pattern) ⇒ Array<BasicPattern>

Wrap non-pattern objects in pattern objects so they can all be treated in the same way during pattern sorting and matching.

Parameters:

Returns:



181
182
183
184
185
186
187
188
189
190
# File 'lib/filigree/match.rb', line 181

def Filigree::wrap_pattern_elements(pattern)
	pattern.map do |el|
		case el
		when BasicPattern then el
		when Class        then InstancePattern.new(el)
		when Regexp       then RegexpPattern.new(el)
		else                   LiteralPattern.new(el)
		end
	end
end