textecho 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/README.md +4 -0
- data/lib/textecho/base.rb +17 -6
- data/lib/textecho/randgen.rb +3 -2
- data/lib/textecho/timecheck.rb +12 -0
- data/test/test_echo.rb +14 -4
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTE2NTM4NWQyN2E0MDdjOTcwZmM0OGM2ODg2NjlkNjFhYzkyYmJhZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjdlZTUzOTA5YWExZjcyNDNmNmU3OGRhOWQxNTdiNzhkMDBhMTliOQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YThjMDdmMzkzYmU1MTZmNTkyOThmMzQyM2NlOGVhZjJkMWM0Nzc1YmJmM2Zl
|
10
|
+
Y2JhODg3ZTc4M2EyNmFkYzA2NjU2N2RiZmI0N2U5N2I0MThhMjAyNWYyOTIx
|
11
|
+
MzkxMTZhMDI4MzM4ZDc0MzlkNGRhZTZiOGU2ZDAxZmQ5NjYyYTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTdmY2VlMDhiODdkODRkNmNlMmI3NDJkMGRmZTM2MGJhNmZhMzYxZGQ4Yjlj
|
14
|
+
NjkzN2ZkNjJjNGVmY2YzZTZiMWM1OGJlMzllMzNkMDA4MjRmNzBmNWExYTM2
|
15
|
+
Mjk4NTAzODkyOTZhN2ZhYzdhYTEyNzQwMDkxN2MwY2M1NGFjYWE=
|
data/README.md
ADDED
data/lib/textecho/base.rb
CHANGED
@@ -3,20 +3,31 @@ require 'rubygems'
|
|
3
3
|
|
4
4
|
module Textecho
|
5
5
|
class Base
|
6
|
-
attr_accessor :input_message,:output_message
|
6
|
+
attr_accessor :input_message,:output_message, :output_list
|
7
7
|
def debug
|
8
8
|
true
|
9
9
|
end
|
10
|
-
def
|
10
|
+
def msgs
|
11
|
+
self.output_list
|
12
|
+
end
|
13
|
+
def setup
|
14
|
+
self.output_list = []
|
15
|
+
end
|
16
|
+
def handle_message(src, msg,locale=nil)
|
17
|
+
setup
|
11
18
|
self.input_message=msg
|
12
19
|
puts "inbound message is "+ self.input_message if debug
|
13
|
-
process(src,
|
20
|
+
process(src,locale)
|
14
21
|
end
|
15
22
|
# @@host= 'localhost:8083'
|
16
|
-
def
|
17
|
-
|
23
|
+
def add_msg(msg)
|
24
|
+
self.output_list << msg
|
25
|
+
end
|
26
|
+
def process(src,locale)
|
27
|
+
self.output_message=self.input_message
|
18
28
|
puts "outbound message is "+ self.output_message if debug
|
19
|
-
self.output_message
|
29
|
+
self.add_msg(self.output_message)
|
30
|
+
self.output_list #should return arrayge of mesages
|
20
31
|
end
|
21
32
|
|
22
33
|
|
data/lib/textecho/randgen.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
module Textecho
|
2
2
|
class Randgen < Textecho::Base
|
3
3
|
|
4
|
-
def process(src,
|
4
|
+
def process(src,locale=nil)
|
5
5
|
n=rand*10
|
6
6
|
nn=rand*10
|
7
7
|
self.output_message=n.to_s+" "+nn.to_s
|
8
8
|
puts "outbound message is "+ self.output_message if debug
|
9
|
-
self.output_message
|
9
|
+
self.add_msg(self.output_message)
|
10
|
+
self.msgs
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Textecho
|
2
|
+
class Timecheck < Textecho::Base
|
3
|
+
|
4
|
+
def process(src,locale=nil)
|
5
|
+
n=Time.now.to_s
|
6
|
+
self.output_message=n.to_s
|
7
|
+
puts "outbound message is "+ self.output_message if debug
|
8
|
+
self.add_msg(self.output_message)
|
9
|
+
self.msgs
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/test/test_echo.rb
CHANGED
@@ -9,16 +9,26 @@ class TestEcho < Test::Unit::TestCase
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_local
|
12
|
-
|
13
|
-
|
12
|
+
msgs=@f.handle_message(@source,@myMsg)
|
13
|
+
assert msgs=@f.msgs, "messages and list not same"
|
14
|
+
assert @f.msgs.first == @myMsg, "message not echoed"
|
14
15
|
end
|
15
16
|
|
16
17
|
def test_rand
|
17
18
|
@f=Textecho::Randgen.new
|
18
|
-
|
19
|
-
assert
|
19
|
+
msgs=@f.handle_message(@source,@myMsg)
|
20
|
+
assert msgs=@f.output_list, "messages and list not same"
|
21
|
+
assert @f.msgs.first != @myMsg, "message echoed"
|
20
22
|
end
|
21
23
|
|
24
|
+
def test_time
|
25
|
+
@f=Textecho::Timecheck.new
|
26
|
+
t=Time.now.to_s
|
27
|
+
msgs=@f.handle_message(@source,@myMsg)
|
28
|
+
assert msgs=@f.msgs, "messages and list not same"
|
29
|
+
msg=@f.msgs.first
|
30
|
+
assert msg == t, "message [#{msg}] [#{t}] "
|
31
|
+
end
|
22
32
|
|
23
33
|
|
24
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: textecho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Sproule
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Common application for telkcomcel in Timor Leste.
|
14
14
|
email: scott.sproule@estormtech.com
|
@@ -18,9 +18,11 @@ extra_rdoc_files: []
|
|
18
18
|
files:
|
19
19
|
- lib/textecho/base.rb
|
20
20
|
- lib/textecho/randgen.rb
|
21
|
+
- lib/textecho/timecheck.rb
|
21
22
|
- lib/textecho.rb
|
22
23
|
- test/test_echo.rb
|
23
24
|
- test/test_helper.rb
|
25
|
+
- README.md
|
24
26
|
homepage: http://github.com/semdinsp/textech
|
25
27
|
licenses: []
|
26
28
|
metadata: {}
|