buschtelefon 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 324cfeafd9c295fdd335f6b60da096845eddb1fd
4
- data.tar.gz: 234ef8b0e84fd3d39880f4d63141887c69445a9f
3
+ metadata.gz: f97ac74a59e40f443954b18c858d246268a48a0f
4
+ data.tar.gz: f417f27ecc8f99c09de25b25a69d85dab46dba03
5
5
  SHA512:
6
- metadata.gz: dd93c3f0f4805b0b849fbdab2f9527d086380694d05eb8e953bbdef4a0b817414c5782cc5e35a51f6fb0519c0b83973e6a49129af0b31f299479c8e5f79afe1a
7
- data.tar.gz: 990c757b4760830488ad70a8cef7eccc9c85375e708989b4d7ac7e6752073d8bda066e43d28b4d9e5aac14cc275a31cacd01176cd7edaa410b25e953f3a309b6
6
+ metadata.gz: 2c685fb7c0adbb17d41cea04bdef2c5f94f50ad9bfb5ce63e8886493251e0bdd096514232138da92691f6581c9807e4256dfa9c34c09d24c8961ef769eab6619
7
+ data.tar.gz: 83ae7243238be220fd6dc57428df6961f3859388999e0afcec3a3d024c0df33d654af770c80e286371aeb3c3921634acf82348cd78f0cf581f77a52bd8281de6
data/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ ## 0.3.0
4
+
5
+ * `NetTattler` now yields a `Gossip` instead of a raw message string.
6
+ * `Gossip` now uses float unix timestamps
7
+
8
+ ## 0.2.0
9
+
10
+ * Host port of `NetTattler` is now optional
11
+ * `NetTattler` makes a brain dump to a `RemoteTattler` if it
12
+ receives [`"\x05"`](https://en.wikipedia.org/wiki/Enquiry_character)
13
+ * `Tattler` exposes its brain as `#knowledge`
14
+ * There are now some Cucumber tests
15
+
16
+ ## 0.1.0
17
+
18
+ * Initial release
data/README.md CHANGED
@@ -35,6 +35,7 @@ Or install it yourself as:
35
35
  You can setup your local tattling meshnet the following way:
36
36
 
37
37
  ```ruby
38
+ require 'buschtelefon'
38
39
  include Buschtelefon
39
40
 
40
41
  aunt_may = NetTattler.new
@@ -47,6 +48,9 @@ Thread.new { aunt_may.listen }
47
48
  Thread.new { aunt_ruth.listen }
48
49
 
49
50
  aunt_may.feed(Gossip.new('Did you hear about the cool company "Renuo"?'))
51
+
52
+ puts aunt_may.knowledge
53
+ puts aunt_ruth.knowledge
50
54
  ```
51
55
 
52
56
  ## Development
@@ -3,18 +3,12 @@ module Buschtelefon
3
3
  attr_reader :created_at, :message
4
4
 
5
5
  def initialize(message)
6
- @created_at = unix_timestamp_ms
6
+ @created_at = Time.now.to_f
7
7
  @message = message
8
8
  end
9
9
 
10
10
  def ==(other)
11
11
  @message == other.message
12
12
  end
13
-
14
- private
15
-
16
- def unix_timestamp_ms
17
- (Time.now.to_f * 1000).to_i
18
- end
19
13
  end
20
14
  end
@@ -14,20 +14,21 @@ module Buschtelefon
14
14
  puts "Started UDP server on #{@port}..."
15
15
 
16
16
  Socket.udp_server_loop(@port) do |message, message_source|
17
- puts "Got \"#{message}\" from #{message_source}"
17
+ # puts "Got \"#{message}\" from #{message_source}"
18
18
  if message == "\x05"
19
19
  handle_knowledge_inquiry(message_source)
20
20
  else
21
- handle_incoming_message(message)
22
- yield(message) if block_given?
21
+ gossip = Gossip.new(message)
22
+ handle_incoming_gossip(gossip)
23
+ yield(gossip) if block_given?
23
24
  end
24
25
  end
25
26
  end
26
27
 
27
28
  private
28
29
 
29
- def handle_incoming_message(message)
30
- feed(Gossip.new(message))
30
+ def handle_incoming_gossip(gossip)
31
+ feed(gossip)
31
32
  end
32
33
 
33
34
  def handle_knowledge_inquiry(message_source)
@@ -11,7 +11,7 @@ module Buschtelefon
11
11
 
12
12
  def feed(gossip)
13
13
  @outbound_socket.send(gossip.message, 0, @host, @port)
14
- puts "Sent \"#{gossip.message}\" to #{@host}:#{@port}"
14
+ # puts "Sent \"#{gossip.message}\" to #{@host}:#{@port}"
15
15
  end
16
16
  end
17
17
  end
@@ -1,3 +1,3 @@
1
1
  module Buschtelefon
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buschtelefon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josua Schmid
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-20 00:00:00.000000000 Z
11
+ date: 2019-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -106,6 +106,7 @@ files:
106
106
  - ".rspec"
107
107
  - ".ruby-version"
108
108
  - ".travis.yml"
109
+ - CHANGELOG.md
109
110
  - Gemfile
110
111
  - LICENSE.txt
111
112
  - README.md