Class: Wongi::Engine::WMEMatchData

Inherits:
Object
  • Object
show all
Defined in:
lib/wongi-engine/wme_match_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(assignments = {}, match = false) ⇒ WMEMatchData

Returns a new instance of WMEMatchData.



5
6
7
8
# File 'lib/wongi-engine/wme_match_data.rb', line 5

def initialize(assignments = {}, match = false)
  @assignments = assignments
  @match = match
end

Instance Attribute Details

#assignmentsObject (readonly)

Returns the value of attribute assignments.



3
4
5
# File 'lib/wongi-engine/wme_match_data.rb', line 3

def assignments
  @assignments
end

Instance Method Details

#&(other) ⇒ Object



26
27
28
# File 'lib/wongi-engine/wme_match_data.rb', line 26

def &(other)
  WMEMatchData.new(assignments.merge(other.assignments), match? && other.match?)
end

#[](key) ⇒ Object



10
11
12
# File 'lib/wongi-engine/wme_match_data.rb', line 10

def [](key)
  assignments[key]
end

#[]=(key, value) ⇒ Object



14
15
16
# File 'lib/wongi-engine/wme_match_data.rb', line 14

def []=(key, value)
  assignments[key] = value
end

#match!Object



22
23
24
# File 'lib/wongi-engine/wme_match_data.rb', line 22

def match!
  @match = true
end

#match?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/wongi-engine/wme_match_data.rb', line 18

def match?
  @match
end