Class: Antelope::DSL::Contexts::Match

Inherits:
Base
  • Object
show all
Defined in:
lib/antelope/dsl/contexts/match.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#call, #context, #initialize

Constructor Details

This class inherits a constructor from Antelope::DSL::Contexts::Base

Instance Attribute Details

#matchesObject (readonly, private) Also known as: data

Returns the value of attribute matches.



15
16
17
# File 'lib/antelope/dsl/contexts/match.rb', line 15

def matches
  @matches
end

Instance Method Details

#before_callObject (private)



18
19
20
# File 'lib/antelope/dsl/contexts/match.rb', line 18

def before_call
  @matches = []
end

#match(options) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/antelope/dsl/contexts/match.rb', line 5

def match(options)
  body   = options.fetch(:body)
  action = options.fetch(:action)
  prec   = options.fetch(:prec, '')

  @matches << { body: body, action: "{#{action}}", prec: prec }
end