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.



7
8
9
10
# File 'lib/wongi-engine/wme_match_data.rb', line 7

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

Instance Attribute Details

#assignmentsObject (readonly)

Returns the value of attribute assignments.



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

def assignments
  @assignments
end

Instance Method Details

#&(other) ⇒ Object



28
29
30
# File 'lib/wongi-engine/wme_match_data.rb', line 28

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

#[](key) ⇒ Object



12
13
14
# File 'lib/wongi-engine/wme_match_data.rb', line 12

def [] key
  assignments[key]
end

#[]=(key, value) ⇒ Object



16
17
18
# File 'lib/wongi-engine/wme_match_data.rb', line 16

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

#match!Object



24
25
26
# File 'lib/wongi-engine/wme_match_data.rb', line 24

def match!
  @match = true
end

#match?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/wongi-engine/wme_match_data.rb', line 20

def match?
  @match
end