yano 0.1.3 → 0.1.4

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
- SHA1:
3
- metadata.gz: 3a00e7f7658bb3d0cc0897d077515de69b6d7ef5
4
- data.tar.gz: fda1ae904eba76f5ebbb94390008c1ac6cb46318
2
+ SHA256:
3
+ metadata.gz: b8c3c1664cd21178b5a13bd8c5232476f2ce00304a228a80e76cc55f978864bc
4
+ data.tar.gz: 3780633c1390da38836dda8e2fefc0f5c14960cd844ee0d1e7791f34aad17f6c
5
5
  SHA512:
6
- metadata.gz: 3f65933f18514044e9d6e79754441ab673b3114b54c73555e227cb33d98a77ea5299a79e3e57d309df6580bf035988c9e4c809b77c7ae6cc7aea72213cc1f457
7
- data.tar.gz: c01fd7318b0bcfc58d2bb4f327b0aed0166591116ce2aab76032045e2ac1564565a27cd6c3797cd9cba4e0c01c956bb39ac23a6d2b61fb21e613d7f4f6a9a748
6
+ metadata.gz: d62a6054705233a06c5489d806227fa5e291806067ca5cf76cb297c0441c76b052ea1151203a99fd046affaed6d378a8a279e8f1d42d3453a74a958eb44edab3
7
+ data.tar.gz: a4ec229d570d5071b7f5f04cdf14d9b546b045932dcf14663b90af6dd1d81b65317b872b72e5c14fbf0218ed2f36fe3c66b321f3c02486fb07b97cf4500ae73a
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ Metrics:
2
+ Enabled: false
3
+
4
+ Style/Documentation:
5
+ Enabled: false
data/.travis.yml CHANGED
@@ -1,5 +1,3 @@
1
- sudo: false
2
1
  language: ruby
3
2
  rvm:
4
- - 2.3.1
5
- before_install: gem install bundler -v 1.12.5
3
+ - 2.5.1
data/Gemfile CHANGED
@@ -1,3 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
5
+ group :test do
6
+ gem 'rspec'
7
+ end
8
+
3
9
  gemspec
data/README.md CHANGED
@@ -1,4 +1,7 @@
1
1
  # Yano
2
+
3
+ [![Build Status](https://travis-ci.org/nikkypx/yano.svg?branch=master)](https://travis-ci.org/nikkypx/yano)
4
+
2
5
  **This is a ruby port of [yn](https://github.com/sindresorhus/yn) by [sindresorhus](https://github.com/sindresorhus)**
3
6
 
4
7
  > Parse yes/no like values
data/Rakefile CHANGED
@@ -1,6 +1,10 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
3
6
 
4
7
  RSpec::Core::RakeTask.new(:spec)
8
+ RuboCop::RakeTask.new
5
9
 
6
- task :default => :spec
10
+ task default: %i[spec]
data/lib/yano/lenient.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Yano
2
4
  module Lenient
3
5
  YES_MATCH_SCORE_THRESHOLD = 2
@@ -13,7 +15,7 @@ module Yano
13
15
  'g' => 0.25,
14
16
  'h' => 0.25,
15
17
  'k' => 0.25
16
- }
18
+ }.freeze
17
19
 
18
20
  E_MATCH = {
19
21
  '2' => 0.25,
@@ -25,7 +27,7 @@ module Yano
25
27
  's' => 0.25,
26
28
  'd' => 0.25,
27
29
  'f' => 0.25
28
- }
30
+ }.freeze
29
31
 
30
32
  S_MATCH = {
31
33
  'q' => 0.25,
@@ -37,7 +39,7 @@ module Yano
37
39
  'z' => 0.25,
38
40
  'x' => 0.25,
39
41
  'c' => 0.25
40
- }
42
+ }.freeze
41
43
 
42
44
  N_MATCH = {
43
45
  'h' => 0.25,
@@ -46,7 +48,7 @@ module Yano
46
48
  'b' => 0.75,
47
49
  'n' => 1,
48
50
  'm' => 0.75
49
- }
51
+ }.freeze
50
52
 
51
53
  O_MATCH = {
52
54
  '9' => 0.25,
@@ -56,10 +58,12 @@ module Yano
56
58
  'p' => 0.75,
57
59
  'k' => 0.25,
58
60
  'l' => 0.25
59
- }
61
+ }.freeze
60
62
 
61
63
  def self.get_yes_match_score(val)
62
- y, e, s = val[0], val[1], val[2]
64
+ y = val[0]
65
+ e = val[1]
66
+ s = val[2]
63
67
  [].tap do |score|
64
68
  score << Y_MATCH[y].to_f
65
69
  score << E_MATCH[e].to_f
@@ -68,7 +72,8 @@ module Yano
68
72
  end
69
73
 
70
74
  def self.get_no_match_score(val)
71
- n, o = val[0], val[1]
75
+ n = val[0]
76
+ o = val[1]
72
77
 
73
78
  [].tap do |score|
74
79
  score << N_MATCH[n].to_f
data/lib/yano/version.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Yano
2
- VERSION = "0.1.3"
4
+ VERSION = '0.1.4'
3
5
  end
data/lib/yano.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yano/version'
2
4
  require 'yano/lenient'
3
5
 
@@ -7,8 +9,8 @@ module Yano
7
9
 
8
10
  def self.parse(val, opts = {})
9
11
  val = val.to_s.strip
10
- return true if !!(val =~ VALID_YES_VALUE)
11
- return false if !!(val =~ VALID_NO_VALUE)
12
12
  return Lenient.check_lenient_values(val) if opts.delete(:lenient)
13
+ return true if val =~ VALID_YES_VALUE
14
+ return false if val =~ VALID_NO_VALUE
13
15
  end
14
16
  end
data/yano.gemspec CHANGED
@@ -1,23 +1,22 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'yano/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "yano"
8
+ spec.name = 'yano'
8
9
  spec.version = Yano::VERSION
9
- spec.authors = ["Nick Palaniuk"]
10
- spec.email = ["npalaniuk@gmail.com"]
10
+ spec.authors = ['Nick Palaniuk']
11
+ spec.email = ['npalaniuk@gmail.com']
11
12
 
12
- spec.summary = %q{Parse yes/no like values, useful for CLI prompts}
13
- spec.description = %q{Parse yes/no like values}
14
- spec.homepage = "https://github.com/nikkypx/yano"
15
- spec.license = "MIT"
13
+ spec.summary = 'Parse yes/no like values, useful for CLI prompts'
14
+ spec.description = 'Parse yes/no like values'
15
+ spec.homepage = 'https://github.com/nikkypx/yano'
16
+ spec.license = 'MIT'
16
17
 
17
18
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ['lib']
21
20
 
22
- spec.add_development_dependency "rspec", "~> 3.0"
21
+ spec.add_development_dependency 'bundler'
23
22
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yano
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Palaniuk
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-06 00:00:00.000000000 Z
11
+ date: 2018-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rspec
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '3.0'
26
+ version: '0'
27
27
  description: Parse yes/no like values
28
28
  email:
29
29
  - npalaniuk@gmail.com
@@ -32,6 +32,7 @@ extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
34
  - ".gitignore"
35
+ - ".rubocop.yml"
35
36
  - ".travis.yml"
36
37
  - Gemfile
37
38
  - LICENSE.txt
@@ -61,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
62
  version: '0'
62
63
  requirements: []
63
64
  rubyforge_project:
64
- rubygems_version: 2.5.1
65
+ rubygems_version: 2.7.6
65
66
  signing_key:
66
67
  specification_version: 4
67
68
  summary: Parse yes/no like values, useful for CLI prompts