Class: ActiveMutator::Subject
- Inherits:
-
Data
- Object
- Data
- ActiveMutator::Subject
- Defined in:
- lib/active_mutator/subject.rb
Overview
A mutable unit. kind :instance/:singleton = one method definition
(byte_range/line_range cover the whole def ... end). kind :class_body =
the class-level code of one class/module (byte_range covers the whole
class/module node; Engine only mutates non-def body statements).
sclass: def lives inside class << self — its source slice is def foo,
so Inserter must target the singleton class, not the constant itself.
Instance Attribute Summary collapse
-
#byte_range ⇒ Object
readonly
Returns the value of attribute byte_range.
-
#constant_scope ⇒ Object
readonly
Returns the value of attribute constant_scope.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#line_range ⇒ Object
readonly
Returns the value of attribute line_range.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#sclass ⇒ Object
readonly
Returns the value of attribute sclass.
Instance Method Summary collapse
- #class_body? ⇒ Boolean
-
#initialize(name:, file:, byte_range:, line_range:, constant_scope:, kind:, sclass: false) ⇒ Subject
constructor
A new instance of Subject.
- #singleton? ⇒ Boolean
Constructor Details
#initialize(name:, file:, byte_range:, line_range:, constant_scope:, kind:, sclass: false) ⇒ Subject
Returns a new instance of Subject.
9 10 11 |
# File 'lib/active_mutator/subject.rb', line 9 def initialize(name:, file:, byte_range:, line_range:, constant_scope:, kind:, sclass: false) super end |
Instance Attribute Details
#byte_range ⇒ Object (readonly)
Returns the value of attribute byte_range
8 9 10 |
# File 'lib/active_mutator/subject.rb', line 8 def byte_range @byte_range end |
#constant_scope ⇒ Object (readonly)
Returns the value of attribute constant_scope
8 9 10 |
# File 'lib/active_mutator/subject.rb', line 8 def constant_scope @constant_scope end |
#file ⇒ Object (readonly)
Returns the value of attribute file
8 9 10 |
# File 'lib/active_mutator/subject.rb', line 8 def file @file end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind
8 9 10 |
# File 'lib/active_mutator/subject.rb', line 8 def kind @kind end |
#line_range ⇒ Object (readonly)
Returns the value of attribute line_range
8 9 10 |
# File 'lib/active_mutator/subject.rb', line 8 def line_range @line_range end |
#name ⇒ Object (readonly)
Returns the value of attribute name
8 9 10 |
# File 'lib/active_mutator/subject.rb', line 8 def name @name end |
#sclass ⇒ Object (readonly)
Returns the value of attribute sclass
8 9 10 |
# File 'lib/active_mutator/subject.rb', line 8 def sclass @sclass end |
Instance Method Details
#class_body? ⇒ Boolean
15 |
# File 'lib/active_mutator/subject.rb', line 15 def class_body? = kind == :class_body |
#singleton? ⇒ Boolean
13 |
# File 'lib/active_mutator/subject.rb', line 13 def singleton? = kind == :singleton |