ekezetalakito 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 515bc51d92e2816b2fd8c8773f9e7554144f4641
4
- data.tar.gz: 39c9eacdd5ee8f4388745d7e3b863c574b1646d2
3
+ metadata.gz: b9f102c50c62150385eb578cd50ba292c15cee20
4
+ data.tar.gz: 218b83c452aac6a8178671d56d84c59f39400d34
5
5
  SHA512:
6
- metadata.gz: 0a10bf7100dfb15f8161498daaa5cdb4e1c26dfea93b3e68d50918b1dbef32db5c5057c40e980dfff83591cb00589b6edb00d53c38ea524656d059c33bc6e1cf
7
- data.tar.gz: ce4b3574f6b68462de36cfb8a4443ee2fe184b33aea71da3d847758d5008ddd7b0d8148949b7b760cd53c7a16419fc488d5f3f2d715f9e2a5502bfbeafe97819
6
+ metadata.gz: e5da3f6f93ed50cdd0b9db752bdc02ffacfd84b6db414409b1b72ae168980e5682b7b51544d892888407a8bacf1e52a83b4fa35cb473ca048200b2764351fab3
7
+ data.tar.gz: 4b9a698f0d93888c74e0240733bce1723804b4c7b773791d497fd27803ce7625cdbdfde0c52447d49e631ae36d522f2a25abff9df9889e915bc816f8c831fa15
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ekezetalakito
2
2
 
3
- This is a simple gem used to convert acute Hungarian accents to utf-8 accented characters. I've created it to practice building a Ruby gem. Its whole functionaly can be substituded with [`unicode_normalize`](http://ruby-doc.org/stdlib-2.2.0/libdoc/unicode_normalize/rdoc/String.html#method-i-unicode_normalize) function from Ruby 2.2.
3
+ This is a simple gem used to convert acute Hungarian accents to utf-8 accented characters. I've created it to practice building a Ruby gem. Its whole functionaly can be substituted with [`unicode_normalize`](http://ruby-doc.org/stdlib-2.2.0/libdoc/unicode_normalize/rdoc/String.html#method-i-unicode_normalize) function from Ruby 2.2.
4
4
 
5
5
  ## Installation
6
6
 
@@ -20,7 +20,11 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- Call the `convert` method by giving a convertable text to it.
23
+ Currently there are two way you can use this gem.
24
+
25
+ First you can call the `convert` method by giving a convertable text to it.
26
+
27
+ Second you can put some text to the Clipboard with accute accents and then (after having successfully installed the gem) running `ekezetalakito` in the command line. This will convert the Clipboard's content.
24
28
 
25
29
  ## Contributing
26
30
 
data/bin/ekezetalakito ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'ekezetalakito'
4
+
5
+ clipboard_content = Ekezetalakito::ClipboardHelper.pbpaste
6
+ clipboard_content = Ekezetalakito.convert(clipboard_content)
7
+ Ekezetalakito::ClipboardHelper.pbcopy(clipboard_content)
@@ -1,26 +1,24 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path('../lib', __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "ekezetalakito/version"
3
+ require 'ekezetalakito/version'
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "ekezetalakito"
6
+ spec.name = 'ekezetalakito'
8
7
  spec.version = Ekezetalakito::VERSION
9
- spec.authors = ["Peter Krassay"]
10
- spec.email = ["peter.krassay@gmail.com"]
8
+ spec.authors = ['Peter Krassay']
9
+ spec.email = ['peter.krassay@gmail.com']
11
10
 
12
- spec.summary = %q{Converts text to use UTF-8 Hungarian accents}
13
- spec.homepage = "https://github.com/farkasseb/ekezetalakito"
14
- spec.license = "MIT"
11
+ spec.summary = 'Converts text to use UTF-8 Hungarian accents'
12
+ spec.homepage = 'https://github.com/farkasseb/ekezetalakito'
13
+ spec.license = 'MIT'
15
14
 
16
15
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
16
  f.match(%r{^(test|spec|features)/})
18
17
  end
19
- spec.bindir = "exe"
20
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
- spec.require_paths = ["lib"]
18
+ spec.executables = 'ekezetalakito'
19
+ spec.require_paths = ['lib']
22
20
 
23
- spec.add_development_dependency "bundler", "~> 1.15"
24
- spec.add_development_dependency "rake", "~> 10.0"
25
- spec.add_development_dependency "rspec", "~> 3.0"
21
+ spec.add_development_dependency 'bundler', '~> 1.15'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+ spec.add_development_dependency 'rspec', '~> 3.0'
26
24
  end
data/lib/ekezetalakito.rb CHANGED
@@ -1,11 +1,10 @@
1
- # encoding: utf-8
2
- require "ekezetalakito/version"
1
+ require 'ekezetalakito/clipboard_helper'
2
+ require 'ekezetalakito/version'
3
3
 
4
4
  module Ekezetalakito
5
+ ACUTE_ACCENTS = ["\u0301", "\u0308" ,"\u030b"].freeze
5
6
 
6
- ACUTE_ACCENTS = ["\u0301", "\u0308" ,"\u030b"]
7
-
8
- # Hungarian accented letters:
7
+ # Hungarian accented letters:
9
8
  # árvíztűrő tükörfúrógép
10
9
  # ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP
11
10
  ACCENTED_LETTERS_MAP = {
@@ -27,7 +26,7 @@ module Ekezetalakito
27
26
  Ú: "U\u0301",
28
27
  Ó: "O\u0301",
29
28
  É: "E\u0301"
30
- }
29
+ }.freeze
31
30
 
32
31
  def self.convert(text)
33
32
  if contains_acute_accent(text)
@@ -41,10 +40,9 @@ module Ekezetalakito
41
40
 
42
41
  def self.contains_acute_accent(text)
43
42
  ACUTE_ACCENTS.each do |accent|
44
- return true if text.index(accent) != nil
43
+ return true unless text.index(accent).nil?
45
44
  end
46
45
 
47
- return false
46
+ false
48
47
  end
49
-
50
48
  end
@@ -0,0 +1,13 @@
1
+ module Ekezetalakito
2
+ class ClipboardHelper
3
+
4
+ def self.pbcopy(text)
5
+ IO.popen('pbcopy', 'w') { |f| f << text }
6
+ end
7
+
8
+ def self.pbpaste
9
+ %x{pbpaste -Prefer txt}
10
+ end
11
+
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Ekezetalakito
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ekezetalakito
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Krassay
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-18 00:00:00.000000000 Z
11
+ date: 2017-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -55,7 +55,8 @@ dependencies:
55
55
  description:
56
56
  email:
57
57
  - peter.krassay@gmail.com
58
- executables: []
58
+ executables:
59
+ - ekezetalakito
59
60
  extensions: []
60
61
  extra_rdoc_files: []
61
62
  files:
@@ -67,9 +68,11 @@ files:
67
68
  - README.md
68
69
  - Rakefile
69
70
  - bin/console
71
+ - bin/ekezetalakito
70
72
  - bin/setup
71
73
  - ekezetalakito.gemspec
72
74
  - lib/ekezetalakito.rb
75
+ - lib/ekezetalakito/clipboard_helper.rb
73
76
  - lib/ekezetalakito/version.rb
74
77
  homepage: https://github.com/farkasseb/ekezetalakito
75
78
  licenses:
@@ -91,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
94
  version: '0'
92
95
  requirements: []
93
96
  rubyforge_project:
94
- rubygems_version: 2.6.11
97
+ rubygems_version: 2.6.14
95
98
  signing_key:
96
99
  specification_version: 4
97
100
  summary: Converts text to use UTF-8 Hungarian accents