Class: Mumukit::Inspection
- Inherits:
-
Object
- Object
- Mumukit::Inspection
- Defined in:
- lib/mumukit/inspection.rb,
lib/mumukit/inspection/version.rb
Defined Under Namespace
Modules: I18n Classes: Expectation, Target
Constant Summary collapse
- VERSION =
'3.0.0'
Instance Attribute Summary collapse
-
#negated ⇒ Object
(also: #negated?)
Returns the value of attribute negated.
-
#target ⇒ Object
Returns the value of attribute target.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type, target, negated = false) ⇒ Inspection
constructor
A new instance of Inspection.
- #negated_to_s ⇒ Object
- #target_to_s ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(type, target, negated = false) ⇒ Inspection
Returns a new instance of Inspection.
12 13 14 15 16 |
# File 'lib/mumukit/inspection.rb', line 12 def initialize(type, target, negated=false) @type = type @target = target @negated = negated end |
Instance Attribute Details
#negated ⇒ Object Also known as: negated?
Returns the value of attribute negated.
9 10 11 |
# File 'lib/mumukit/inspection.rb', line 9 def negated @negated end |
#target ⇒ Object
Returns the value of attribute target.
9 10 11 |
# File 'lib/mumukit/inspection.rb', line 9 def target @target end |
#type ⇒ Object
Returns the value of attribute type.
9 10 11 |
# File 'lib/mumukit/inspection.rb', line 9 def type @type end |
Class Method Details
.parse(insepection_s) ⇒ Object
38 39 40 41 |
# File 'lib/mumukit/inspection.rb', line 38 def self.parse(insepection_s) raise "Invalid inspection #{insepection_s}" unless insepection_s =~ /^(Not\:)?([^\:]+)\:?(.+)?$/ Inspection.new($2, Mumukit::Inspection::Target.parse($3), $1.present?) end |
.parse_binding_name(binding_s) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/mumukit/inspection.rb', line 30 def self.parse_binding_name(binding_s) if binding_s.start_with? 'Intransitive:' binding_s[13..-1] else binding_s end end |
Instance Method Details
#negated_to_s ⇒ Object
22 23 24 |
# File 'lib/mumukit/inspection.rb', line 22 def negated_to_s negated ? 'Not:' : nil end |
#target_to_s ⇒ Object
26 27 28 |
# File 'lib/mumukit/inspection.rb', line 26 def target_to_s target ? ":#{target.to_s}" : nil end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/mumukit/inspection.rb', line 18 def to_s "#{negated_to_s}#{type}#{target_to_s}" end |