morsecode 0.1.1 → 0.1.2

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 (2) hide show
  1. data/lib/morsecode.rb +7 -5
  2. metadata +1 -1
data/lib/morsecode.rb CHANGED
@@ -7,18 +7,20 @@ require 'rexml/document'
7
7
  class MorseCode
8
8
  include REXML
9
9
 
10
- def initialize()
10
+ def initialize(x)
11
11
  buffer = File.open(File.dirname(__FILE__) + '/morsecode.xml','r').read
12
12
  doc = Document.new(buffer)
13
13
  @h = Hash[XPath.match(doc.root, 'records/code').map{|x| x.map{|name| name.text.to_s}}]
14
+
15
+ @x = x
14
16
  end
15
17
 
16
- def morse_input(codes)
17
- codes.split(/4/).map{|code| @h[code]}.join()
18
+ def to_s
19
+ @x.split(/4/).map{|code| @h[code]}.join()
18
20
  end
19
21
 
20
- def char_input(chars)
21
- chars.split(//).map{|char| @h.invert[char]}.join('4')
22
+ def to_mc
23
+ @x.split(//).map{|char| @h.invert[char]}.join('4')
22
24
  end
23
25
 
24
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morsecode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors: []
7
7