telegraph 1.0.2 → 1.0.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 +4 -4
- metadata +5 -5
- data/README.rdoc +0 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bab64c7d7ffc42134a7a811de4d459bd1f775df07f0682fe7f69710c47a9645c
|
4
|
+
data.tar.gz: c90ebd06d04d029a1a639487bc646b0dfda9a7e369abda3153183230e0ca7aad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b223b0a556593815aeeb4939b73f509a6be50f7f0adb711eaa6cdd8db1ea0b0832695e38154731f691d9a6023ce3eeb2bc760000e0f8f65f7fe153ce13ff748
|
7
|
+
data.tar.gz: b111de63a89e53d477945ca765d8a8a28d5b4c25292463f27d617edf699e9dbd062a2bebceddc65f80a4f595a7eeb04b82a68e417fcae9279be806ac6704a655
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: telegraph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juanjo Bazán
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -24,14 +24,14 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.10.0
|
27
|
-
description: Telegraph provides a simple text-to-morse, morse-to-text
|
27
|
+
description: Morse code translation. Telegraph provides a simple text-to-morse, morse-to-text
|
28
|
+
translator.
|
28
29
|
email: jjbazan@gmail.com
|
29
30
|
executables: []
|
30
31
|
extensions: []
|
31
32
|
extra_rdoc_files: []
|
32
33
|
files:
|
33
34
|
- MIT-LICENSE.txt
|
34
|
-
- README.rdoc
|
35
35
|
- lib/morse_characters.rb
|
36
36
|
- lib/telegraph.rb
|
37
37
|
homepage: http://github.com/xuanxu/telegraph
|
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
57
|
requirements: []
|
58
|
-
rubygems_version: 3.
|
58
|
+
rubygems_version: 3.4.20
|
59
59
|
signing_key:
|
60
60
|
specification_version: 4
|
61
61
|
summary: Ruby gem to read and write Morse code
|
data/README.rdoc
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
= Telegraph
|
2
|
-
|
3
|
-
Telegraph is a Ruby gem that provides straightforward text-to-morse and morse-to-text translators
|
4
|
-
|
5
|
-
It uses as reference the document {'RECOMMENDATION ITU-R M.1677'}[https://www.itu.int/rec/R-REC-M.1677-1-200910-I] from the International Telecommunication Union, Radiocommunication Sector (ITU-R), the United Nations agency for information and communication technology issues.
|
6
|
-
|
7
|
-
{<img src="https://badge.fury.io/rb/telegraph.png" alt="Gem Version" />}[http://badge.fury.io/rb/telegraph]
|
8
|
-
{<img src="https://github.com/xuanxu/telegraph/actions/workflows/tests.yml/badge.svg" alt="Build status" />}[https://github.com/xuanxu/telegraph/actions/workflows/tests.yml]
|
9
|
-
|
10
|
-
== Getting started
|
11
|
-
|
12
|
-
Install the gem:
|
13
|
-
$ [sudo] gem install telegraph
|
14
|
-
|
15
|
-
Then depending on your project you may:
|
16
|
-
|
17
|
-
require the gem (if a ruby project):
|
18
|
-
require 'telegraph'
|
19
|
-
or add it to your Gemfile (if you're on Rails):
|
20
|
-
gem 'telegraph', :git => 'git://github.com/xuanxu/telegraph.git'
|
21
|
-
|
22
|
-
|
23
|
-
== Usage
|
24
|
-
|
25
|
-
The simplest way to read or write morse code is using directly the two methods defined in Telegraph:
|
26
|
-
|
27
|
-
# Converts text to morse characters:
|
28
|
-
Telegraph.text_to_morse("Hello world") #=> ".... . .-.. .-.. --- .-- --- .-. .-.. -.."
|
29
|
-
|
30
|
-
# Reads morse characters into text:
|
31
|
-
Telegraph.morse_to_text(".... . .-.. .-.. --- .-- --- .-. .-.. -..") #=> hello world"
|
32
|
-
|
33
|
-
In the Telegraph module you will find defined also the most commonly used prosigns:
|
34
|
-
|
35
|
-
# Error sign:
|
36
|
-
Telegraph::Error #=> "........"
|
37
|
-
|
38
|
-
#The complete list of prosigns:
|
39
|
-
Telegraph::Error
|
40
|
-
Telegraph::Understood
|
41
|
-
Telegraph::Invitation_to_transmit
|
42
|
-
Telegraph::Wait
|
43
|
-
Telegraph::End_of_work
|
44
|
-
Telegraph::Starting_signal
|
45
|
-
|
46
|
-
All the generated morse code will use the character '.' as short signal (aka dot) and the character '-' as long signal (aka dash).
|
47
|
-
|
48
|
-
If you need to write or read using different characters as short and long signals you can do it instantiating your own <tt>Telegraph::MorseTransmission</tt> class:
|
49
|
-
|
50
|
-
# User defined dot & dash (:short and :long defaults to '.' and '-')
|
51
|
-
morser = Telegraph::MorseTransmission.new(:short =>'x', :long => '3')
|
52
|
-
|
53
|
-
and then using the methods to read/write:
|
54
|
-
|
55
|
-
# write morse code with custom signals
|
56
|
-
morser.text_to_morse("Hello world") #=> "xxxx x x3xx x3xx 333 x33 333 x3x x3xx 3xx"
|
57
|
-
|
58
|
-
# read morse code with custom signals
|
59
|
-
morser.morse_to_text("xxxx x x3xx x3xx 333 x33 333 x3x x3xx 3xx") #=> hello world"
|
60
|
-
morser.error #=> "xxxxxxxx"
|
61
|
-
|
62
|
-
== Credits
|
63
|
-
|
64
|
-
Author:: Juanjo Bazán
|
65
|
-
Copyright:: Copyright (c) 2013 - ∞ Juanjo Bazán
|
66
|
-
License:: Released under the MIT license.
|
67
|
-
|