telegraph 1.0.1 → 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.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE.txt +1 -1
  3. data/lib/telegraph.rb +4 -4
  4. metadata +39 -64
  5. data/README.rdoc +0 -64
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bab64c7d7ffc42134a7a811de4d459bd1f775df07f0682fe7f69710c47a9645c
4
+ data.tar.gz: c90ebd06d04d029a1a639487bc646b0dfda9a7e369abda3153183230e0ca7aad
5
+ SHA512:
6
+ metadata.gz: 4b223b0a556593815aeeb4939b73f509a6be50f7f0adb711eaa6cdd8db1ea0b0832695e38154731f691d9a6023ce3eeb2bc760000e0f8f65f7fe153ce13ff748
7
+ data.tar.gz: b111de63a89e53d477945ca765d8a8a28d5b4c25292463f27d617edf699e9dbd062a2bebceddc65f80a4f595a7eeb04b82a68e417fcae9279be806ac6704a655
data/MIT-LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 Juanjo Bazán
1
+ Copyright (c) 2010-2022 Juanjo Bazán
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/lib/telegraph.rb CHANGED
@@ -16,7 +16,7 @@ module Telegraph
16
16
  # The encode is made following the official RECOMMENDATION ITU-R M.1677.
17
17
  # The returned string uses a single space as letter separator and a seven spaces gap as word separator.
18
18
  #
19
- # Telegraph.text_to_morse("Hello world") #=> ".... . .-.. .-.. --- .-- --- .-. .-.. -.."
19
+ # Telegraph.text_to_morse("Hello world") #=> ".... . .-.. .-.. --- .-- --- .-. .-.. -.."
20
20
  #
21
21
  def self.text_to_morse(text)
22
22
  text.strip.downcase.split(" ").inject([]){|morse_words, word|
@@ -31,7 +31,7 @@ module Telegraph
31
31
  #
32
32
  # The returned string is completly downcased.
33
33
  #
34
- # Telegraph.morse_to_text(".... . .-.. .-.. --- .-- --- .-. .-.. -..") #=> hello world"
34
+ # Telegraph.morse_to_text(".... . .-.. .-.. --- .-- --- .-. .-.. -..") #=> hello world"
35
35
  #
36
36
  def self.morse_to_text(morse)
37
37
  morse.split(LETTERS_TO_MORSE[" "]).inject([]){|words, morse_word|
@@ -66,7 +66,7 @@ module Telegraph
66
66
  # The returned string uses a single space as letter separator and a seven spaces gap as word separator.
67
67
  #
68
68
  # morser = Telegraph::MorseTransmission.new(:short =>'x', :long => '3')
69
- # morser.text_to_morse("Hello world") #=> "xxxx x x3xx x3xx 333 x33 333 x3x x3xx 3xx"
69
+ # morser.text_to_morse("Hello world") #=> "xxxx x x3xx x3xx 333 x33 333 x3x x3xx 3xx"
70
70
  #
71
71
  def text_to_morse(text)
72
72
  morse = Telegraph.text_to_morse(text)
@@ -81,7 +81,7 @@ module Telegraph
81
81
  # The returned string is completly downcased.
82
82
  #
83
83
  # morser = Telegraph::MorseTransmission.new(:short =>'x', :long => '3')
84
- # morser.morse_to_text("xxxx x x3xx x3xx 333 x33 333 x3x x3xx 3xx") #=> hello world"
84
+ # morser.morse_to_text("xxxx x x3xx x3xx 333 x33 333 x3x x3xx 3xx") #=> hello world"
85
85
  #
86
86
  def morse_to_text(morse)
87
87
  morse = undo_dot_dash(morse.strip)
metadata CHANGED
@@ -1,87 +1,62 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: telegraph
3
- version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 0
9
- - 1
10
- version: 1.0.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
11
5
  platform: ruby
12
- authors:
13
- - "Juanjo Baz\xC3\xA1n"
14
- autorequire:
6
+ authors:
7
+ - Juanjo Bazán
8
+ autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2010-11-09 00:00:00 +01:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
11
+ date: 2023-11-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: rspec
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
27
17
  - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 11
30
- segments:
31
- - 2
32
- - 1
33
- - 0
34
- version: 2.1.0
18
+ - !ruby/object:Gem::Version
19
+ version: 3.10.0
35
20
  type: :development
36
- version_requirements: *id001
37
- description: Telegraph provides a simple text-to-morse, morse-to-text translator.
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.10.0
27
+ description: Morse code translation. Telegraph provides a simple text-to-morse, morse-to-text
28
+ translator.
38
29
  email: jjbazan@gmail.com
39
30
  executables: []
40
-
41
31
  extensions: []
42
-
43
32
  extra_rdoc_files: []
44
-
45
- files:
33
+ files:
46
34
  - MIT-LICENSE.txt
47
- - README.rdoc
48
35
  - lib/morse_characters.rb
49
36
  - lib/telegraph.rb
50
- has_rdoc: true
51
37
  homepage: http://github.com/xuanxu/telegraph
52
38
  licenses: []
53
-
54
- post_install_message:
55
- rdoc_options:
56
- - --main
39
+ metadata: {}
40
+ post_install_message:
41
+ rdoc_options:
42
+ - "--main"
57
43
  - README.rdoc
58
- - --charset=UTF-8
59
- require_paths:
44
+ - "--charset=UTF-8"
45
+ require_paths:
60
46
  - lib
61
- required_ruby_version: !ruby/object:Gem::Requirement
62
- none: false
63
- requirements:
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
64
49
  - - ">="
65
- - !ruby/object:Gem::Version
66
- hash: 3
67
- segments:
68
- - 0
69
- version: "0"
70
- required_rubygems_version: !ruby/object:Gem::Requirement
71
- none: false
72
- requirements:
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
73
54
  - - ">="
74
- - !ruby/object:Gem::Version
75
- hash: 3
76
- segments:
77
- - 0
78
- version: "0"
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
79
57
  requirements: []
80
-
81
- rubyforge_project:
82
- rubygems_version: 1.3.7
83
- signing_key:
84
- specification_version: 3
58
+ rubygems_version: 3.4.20
59
+ signing_key:
60
+ specification_version: 4
85
61
  summary: Ruby gem to read and write Morse code
86
62
  test_files: []
87
-
data/README.rdoc DELETED
@@ -1,64 +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' from the International Telecommunication Union, Radiocommunication Sector (ITU-R), the United Nations agency for information and communication technology issues.
6
-
7
- == Getting started
8
-
9
- Install the gem:
10
- $ [sudo] gem install telegraph
11
-
12
- Then depending on your project you may:
13
-
14
- require the gem (if a ruby project):
15
- require 'telegraph'
16
- or add it to your Gemfile (if you're on Rails):
17
- gem 'telegraph', :git => 'git://github.com/xuanxu/telegraph.git'
18
-
19
-
20
- == Usage
21
-
22
- The simplest way to read or write morse code is using directly the two methods defined in Telegraph:
23
-
24
- # Converts text to morse characters:
25
- Telegraph.text_to_morse("Hello world") #=> ".... . .-.. .-.. --- .-- --- .-. .-.. -.."
26
-
27
- # Reads morse characters into text:
28
- Telegraph.morse_to_text(".... . .-.. .-.. --- .-- --- .-. .-.. -..") #=> hello world"
29
-
30
- In the Telegraph module you will find defined also the most commonly used prosigns:
31
-
32
- # Error sign:
33
- Telegraph::Error #=> "........"
34
-
35
- #The complete list of prosigns:
36
- Telegraph::Error
37
- Telegraph::Understood
38
- Telegraph::Invitation_to_transmit
39
- Telegraph::Wait
40
- Telegraph::End_of_work
41
- Telegraph::Starting_signal
42
-
43
- All the generated morse code will use the character '.' as short signal (aka dot) and the character '-' as long signal (aka dash).
44
-
45
- If you need to write or read using different characters as short and long signals you can do it instantiating your own Telegraph::MorseTransmission class:
46
-
47
- # User defined dot & dash (:short and :long defaults to '.' and '-')
48
- morser = Telegraph::MorseTransmission.new(:short =>'x', :long => '3')
49
-
50
- and then using the methods to read/write:
51
-
52
- # write morse code with custom signals
53
- morser.text_to_morse("Hello world") #=> "xxxx x x3xx x3xx 333 x33 333 x3x x3xx 3xx"
54
-
55
- # read morse code with custom signals
56
- morser.morse_to_text("xxxx x x3xx x3xx 333 x33 333 x3x x3xx 3xx") #=> hello world"
57
- morser.error #=> "xxxxxxxx"
58
-
59
- == Credits
60
-
61
- Author:: Juanjo Bazán
62
- Copyright:: Copyright (c) 2010 Juanjo Bazán
63
- License:: Released under the MIT license.
64
-