colorcode_convert_rgb 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: 06bc747898efd94adc3910f0b07f3495ed1ab7329c29a4baace7ffcc19c72765
4
- data.tar.gz: 7366416abe99ebac7f9323ac2ad1ee6f7891de013b38c6ae07761be7226b7744
3
+ metadata.gz: de9e1bb602a6fc3316f87c15b9bd75b2fe7ca971efd243f49759930009babfb8
4
+ data.tar.gz: a6329842aad765a418db04a3d0efcdab4740909c9181a0e10f55d634d66f6f67
5
5
  SHA512:
6
- metadata.gz: 2a42c231c01e3d8ba375baaa7142d84586d6b9f8bd248e3b390cad097b3ba6db3f61ac8485150f123dddbd023d382474c9d2998d005eddde17938fe2f932d6c9
7
- data.tar.gz: 76a0199ca3aa34892cb5cd9aa193102152de5823ba8311299507562865162722f2f40470a6ced308d65b1b502fbbc07c275977ac70394f41c963af3b82bc97be
6
+ metadata.gz: 22add2bd1f01c8121d00912738769e9e2df9c7d4d864290362a01598380eac5a2a10c3dddd3b03cee37bab942ca4d4374f9184ba6bde1802a0afb172b23791e8
7
+ data.tar.gz: 7a7b4f9ec31b0e6bb6d341e74415067c4e2154af3349111c5941c04339574c2471257c994170c386c168d9926e6807d28528c4bb94cb56b3f4b4fbc93d9292f9
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- colorcode_convert_rgb (0.1.0)
4
+ colorcode_convert_rgb (0.1.1)
5
5
  thor
6
6
 
7
7
  GEM
@@ -20,4 +20,4 @@ DEPENDENCIES
20
20
  rake (~> 12.0)
21
21
 
22
22
  BUNDLED WITH
23
- 2.1.2
23
+ 2.1.2
@@ -4,7 +4,14 @@ require "thor"
4
4
  module ColorcodeConvertRgb
5
5
  class CLI < Thor
6
6
  desc "to_ints {Hexagonal_color_code}", "Converts a hexadecimal color code to a decimal number."
7
- def to_ints(hex)
7
+ def to_ints(color)
8
+ if color.match(/[a-fA-F0-9]{6}/)
9
+ hex = color
10
+ elsif color.match(/[#][a-fA-F0-9]{6}/)
11
+ hex = color.delete("#")
12
+ else
13
+ return puts 'Please enter the correct code.(e.g. #ffffff or ffffff )'
14
+ end
8
15
  r, g, b = hex[0..1], hex[2..3], hex[4..5]
9
16
  rgb = [r, g, b].map(&:hex)
10
17
  puts "RGB is #{rgb}."
@@ -1,3 +1,3 @@
1
1
  module ColorcodeConvertRgb
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colorcode_convert_rgb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - tomohiro