class Evoc::Rule

Attributes

human_lhs[RW]
human_rhs[RW]
lhs[RW]
name[RW]
rhs[RW]
tx_store[RW]

Public Class Methods

new(lhs:,rhs:,tx_store: nil,**measures) click to toggle source
# File lib/evoc/rule.rb, line 6
def initialize(lhs:,rhs:,tx_store: nil,**measures)
  self.lhs = lhs.is_a?(Array) ? lhs.sort : [lhs]
  self.rhs = rhs.is_a?(Array) ? rhs.sort : [rhs]
  self.name = "#{self.lhs.join(",")} -> #{self.rhs.join(",")}" 
  self.tx_store = tx_store
  measures.each do |measure,value|
    set_measure(measure,value)
  end
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/evoc/rule.rb, line 16
def <=> other
 other.name <=> self.name
end
human_name() click to toggle source
# File lib/evoc/rule.rb, line 24
def human_name
  "#{human_lhs} -> #{human_rhs}"
end
lhs=(input) click to toggle source
# File lib/evoc/rule.rb, line 40
def lhs=input
  input.is_a?(Array) ? @lhs = input : @lhs = [input]
end
rhs=(input) click to toggle source
# File lib/evoc/rule.rb, line 44
def rhs=input
  input.is_a?(Array) ? @rhs = input : @rhs = [input]
end
to_s() click to toggle source
# File lib/evoc/rule.rb, line 20
def to_s
  name
end