Class: Kintama::Runnable

Inherits:
Object
  • Object
show all
Defined in:
lib/kintama/runnable.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.definitionObject

Returns the value of attribute definition.



4
5
6
# File 'lib/kintama/runnable.rb', line 4

def definition
  @definition
end

.nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/kintama/runnable.rb', line 4

def name
  @name
end

Class Method Details

.full_nameObject

Returns the full name of this context, taking any parent contexts into account



24
25
26
27
28
29
30
# File 'lib/kintama/runnable.rb', line 24

def full_name
  if instance_variable_defined?(:@name) && @name
    [parent ? parent.full_name : nil, @name].compact.join(" ")
  else
    nil
  end
end

.is_a_context?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/kintama/runnable.rb', line 15

def is_a_context?
  !is_a_test?
end

.is_a_test?Boolean

Returns:

  • (Boolean)


10
11
12
13
# File 'lib/kintama/runnable.rb', line 10

def is_a_test?
  ancestors.index(Kintama::Test) && 
  ancestors.index(Kintama::Test) < ancestors.index(Kintama::Context)
end

.line_definedObject



32
33
34
# File 'lib/kintama/runnable.rb', line 32

def line_defined
  definition ? definition.last : nil
end

.parentObject



19
20
21
# File 'lib/kintama/runnable.rb', line 19

def parent
  superclass.ancestors.include?(Kintama::Context) ? superclass : nil
end

.to_sObject



6
7
8
# File 'lib/kintama/runnable.rb', line 6

def to_s
  "<#{is_a_test? ? 'Test' : 'Context'}:#{name}>"
end