Class: TestModule::TestSlim

Inherits:
Object
  • Object
show all
Defined in:
lib/test_module/test_slim.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(generation = 0) ⇒ TestSlim

Returns a new instance of TestSlim.



15
16
17
18
19
# File 'lib/test_module/test_slim.rb', line 15

def initialize(generation = 0)
  @generation = generation
  @sut = SystemUnderTest.new
  @string = "string"
end

Instance Attribute Details

#stringObject

Returns the value of attribute string.



13
14
15
# File 'lib/test_module/test_slim.rb', line 13

def string
  @string
end

#sutObject (readonly)

Returns the value of attribute sut.



12
13
14
# File 'lib/test_module/test_slim.rb', line 12

def sut
  @sut
end

Instance Method Details

#add(a, b) ⇒ Object



29
30
31
# File 'lib/test_module/test_slim.rb', line 29

def add(a, b)
  a+b
end

#call_on(method, object) ⇒ Object



73
74
75
# File 'lib/test_module/test_slim.rb', line 73

def call_on(method, object)
  object.send(method.to_sym)
end

#create_test_slim_with_string(string) ⇒ Object



57
58
59
60
61
# File 'lib/test_module/test_slim.rb', line 57

def create_test_slim_with_string(string)
  slim = TestSlim.new(@generation + 1)
  slim.string = string
  slim
end

#echo(x) ⇒ Object



33
34
35
# File 'lib/test_module/test_slim.rb', line 33

def echo(x)
  x
end

#echo_int(i) ⇒ Object



41
42
43
# File 'lib/test_module/test_slim.rb', line 41

def echo_int i
  i
end

#echo_object(method, string) ⇒ Object



69
70
71
# File 'lib/test_module/test_slim.rb', line 69

def echo_object(method, string)
  OpenStruct.new(method.to_sym => string)
end

#echo_string(s) ⇒ Object



45
46
47
# File 'lib/test_module/test_slim.rb', line 45

def echo_string s
  s
end

#new_with_string(string) ⇒ Object



63
64
65
66
67
# File 'lib/test_module/test_slim.rb', line 63

def new_with_string(string)
  s = TestSlim.new
  s.string = string
  s
end

#nullObject



37
38
39
# File 'lib/test_module/test_slim.rb', line 37

def null
  nil
end

#return_stringObject



21
22
23
# File 'lib/test_module/test_slim.rb', line 21

def return_string
  @string
end

#returnStringObject

Should not ever be called.



25
26
27
# File 'lib/test_module/test_slim.rb', line 25

def returnString  #Should not ever be called.
  "blah"
end

#syntax_errorObject



49
50
51
# File 'lib/test_module/test_slim.rb', line 49

def syntax_error
  eval "1,2"
end

#utf8Object



53
54
55
# File 'lib/test_module/test_slim.rb', line 53

def utf8
  "Espa\357\277\275ol"
end