Class: Bmg::Operator::Autosummarize::Same

Inherits:
Object
  • Object
show all
Defined in:
lib/bmg/operator/autosummarize.rb

Overview

Summarizes by enforcing that the same dependent is observed for a given determinant, returning the dependent as summarization.

Constant Summary collapse

INSTANCE =
new

Instance Method Summary collapse

Instance Method Details

#init(v) ⇒ Object



182
183
184
# File 'lib/bmg/operator/autosummarize.rb', line 182

def init(v)
  v
end

#inspectObject Also known as: to_s



195
196
197
# File 'lib/bmg/operator/autosummarize.rb', line 195

def inspect
  ":same"
end

#sum(v1, v2) ⇒ Object

Raises:



186
187
188
189
# File 'lib/bmg/operator/autosummarize.rb', line 186

def sum(v1, v2)
  raise TypeError, "Same values expected, got `#{v1}` vs. `#{v2}`" unless v1 == v2
  v1
end

#term(v) ⇒ Object



191
192
193
# File 'lib/bmg/operator/autosummarize.rb', line 191

def term(v)
  v
end