Class: Regressor::Model::Expression

Inherits:
Object
  • Object
show all
Defined in:
lib/model/expression.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subject, expectation, matcher, matcher_expectation, modification = nil) ⇒ Expression

Returns a new instance of Expression.



7
8
9
10
11
12
13
# File 'lib/model/expression.rb', line 7

def initialize(subject, expectation, matcher, matcher_expectation, modification = nil)
  self.subject = subject
  self.expectation = expectation
  self.matcher = matcher
  self.matcher_expectation = matcher_expectation
  self.modification = modification
end

Instance Attribute Details

#expectationObject

Returns the value of attribute expectation.



5
6
7
# File 'lib/model/expression.rb', line 5

def expectation
  @expectation
end

#matcherObject

Returns the value of attribute matcher.



5
6
7
# File 'lib/model/expression.rb', line 5

def matcher
  @matcher
end

#matcher_expectationObject

Returns the value of attribute matcher_expectation.



5
6
7
# File 'lib/model/expression.rb', line 5

def matcher_expectation
  @matcher_expectation
end

#modificationObject

Returns the value of attribute modification.



5
6
7
# File 'lib/model/expression.rb', line 5

def modification
  @modification
end

#subjectObject

Returns the value of attribute subject.



5
6
7
# File 'lib/model/expression.rb', line 5

def subject
  @subject
end

Instance Method Details

#to_sObject



15
16
17
18
19
20
21
# File 'lib/model/expression.rb', line 15

def to_s
  if self.modification.nil?
    "it { #{self.subject}.#{self.expectation} #{self.matcher}(:#{self.matcher_expectation}) }"
  else
    "it { #{self.subject}.#{self.expectation} #{self.matcher}(:#{self.matcher_expectation}).#{self.modification} }"
  end
end