rqrcode_kingblade 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1108d2ecc8c6e66e7205daae73e980049eed9c3f
4
+ data.tar.gz: 77883b34701320f7167857c0fcd541a8ce0a0b0c
5
+ SHA512:
6
+ metadata.gz: 7280b74caa1efec6d26a01d1e0905f284b66e90eb3a31c1810b3534e5382c8a08e20e7cac15f78926776ed962d7f985934cb1569e22430c7d92d9c3e9e3d06fe
7
+ data.tar.gz: bffe17a164868b68037ce2416553983351662e6ba7d4a71bf5fdb8ccf6ef9233c7b57c1c829d0cab0b56b5eabdc077ff409ef443313f7d49b1dcb7d6c3cfbda9
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.1
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rqrcode_kingblade.gemspec
4
+ gemspec
5
+
data/Guardfile ADDED
@@ -0,0 +1,21 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ # Note: The cmd option is now required due to the increasing number of ways
5
+ # rspec may be run, below are examples of the most common uses.
6
+ # * bundler: 'bundle exec rspec'
7
+ # * bundler binstubs: 'bin/rspec'
8
+ # * spring: 'bin/rsspec' (This will use spring if running and you have
9
+ # installed the spring binstubs per the docs)
10
+ # * zeus: 'zeus rspec' (requires the server to be started separetly)
11
+ # * 'just' rspec: 'rspec'
12
+ guard :rspec, cmd: 'bundle exec rspec' do
13
+ watch(%r{^spec/.+_spec\.rb$})
14
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
15
+ watch('spec/spec_helper.rb') { 'spec' }
16
+ end
17
+
18
+ guard :rubocop do
19
+ watch(%r{.+\.rb$})
20
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
21
+ end
data/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # RqrcodeKingblade
2
+
3
+ This gem can make qrcode file for kingbladeIII(infinity)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rqrcode_kingblade'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install rqrcode_kingblade
20
+
21
+ ## Usage
22
+
23
+ Initialize class
24
+
25
+ rqr_kb = RqrcoreKingblade::RqrcodeKingblade.new
26
+
27
+ Add title.
28
+
29
+ ```ruby
30
+ rqr_kb.title = "title hoge"
31
+ ```
32
+
33
+ Add color data.
34
+ Format is RGBdata plus brightness(v).
35
+
36
+ ```ruby
37
+ rqr_kb.add_color(r = 0,g = 100 ,b = 150, brightness = 140, 0)
38
+ ```
39
+
40
+ Set the name of the file to be output
41
+
42
+ ```ruby
43
+ rqr_kb.filename = "filename.png"
44
+ ```
45
+
46
+ You want to output the file of the QR code.
47
+
48
+ ```ruby
49
+ rqr_kb.to_qrcode
50
+ ```
51
+
52
+ You want to output the image data of png format.
53
+
54
+ ```ruby
55
+ rqr_kb.to_img
56
+ ```
57
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rqrcode_kingblade"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/lib/kb_color.rb ADDED
@@ -0,0 +1,23 @@
1
+ class KbColor
2
+ attr_accessor :r,:g,:b,:v,:a
3
+
4
+ def initialize()
5
+ @r = 0
6
+ @g = 0
7
+ @b = 0
8
+ @v = 0
9
+ @a = 0
10
+ end
11
+
12
+ def to_s()
13
+ convert_s(@r) + convert_s(@g) + convert_s(@b) + convert_s(@v) + convert_s(@a)
14
+ end
15
+
16
+ def convert_s(x )
17
+ x = x.to_s(16)
18
+ if x.length == 1
19
+ x = "0" + x.to_s
20
+ end
21
+ return x
22
+ end
23
+ end
data/lib/kb_colors.rb ADDED
@@ -0,0 +1,59 @@
1
+ require File.dirname(__FILE__) + '/kb_color.rb'
2
+ class KbColors
3
+ attr_accessor :header
4
+ attr_accessor :title
5
+ attr_accessor :kb_colors
6
+
7
+
8
+ def initialize(opts = {})
9
+ @kb_colors = Array.new()
10
+ @title = ""
11
+ @header = "Copyright RU**AN"
12
+ @max_length = 15
13
+ if opts[:title]
14
+ @title = opts[:title]
15
+ end
16
+ end
17
+
18
+ def add_color(r = 0, g = 0, b = 0, v = 0, a = 0)
19
+ if @kb_colors.length >= @max_length
20
+ return false
21
+ end
22
+ kb_color = KbColor.new()
23
+ kb_color.r = r % 256
24
+ kb_color.g = g % 256
25
+ kb_color.b = b % 256
26
+ kb_color.v = v % 256
27
+ kb_color.a = a % 256
28
+ @kb_colors.push kb_color
29
+ return @kb_colors.length
30
+ end
31
+
32
+ def set_title(tmp_title = "")
33
+ @title = tmp_title
34
+ end
35
+
36
+ def delete_at(at)
37
+ if at.nil? or at >= @kb_colors.length - 1
38
+ return false
39
+ end
40
+ @kb_colors.delete_at at
41
+ return self
42
+ end
43
+
44
+ def length()
45
+ return @kb_colors.length
46
+ end
47
+
48
+ def to_s()
49
+ s = ""
50
+ s += @header.to_s + "\n"
51
+ s += @title.to_s + "\n"
52
+ if @kb_colors
53
+ @kb_colors.each do |kb_color|
54
+ s += kb_color.to_s + "\n"
55
+ end
56
+ end
57
+ return s
58
+ end
59
+ end
@@ -0,0 +1,3 @@
1
+ module RqrcodeKingblade
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,34 @@
1
+ require "rqrcode_kingblade/version"
2
+ require File.dirname(__FILE__) + '/kb_colors.rb'
3
+ require 'rqrcode_png'
4
+
5
+ module RqrcodeKingblade
6
+ class RqrcodeKingblade
7
+ attr_accessor :filename
8
+ def initialize
9
+ @kb_colors = KbColors.new
10
+ @kb_colors.title = "test"
11
+ @filename = "test.png"
12
+ end
13
+
14
+ def title(title)
15
+ @kb_colors.title = title
16
+ end
17
+
18
+ def add_color(r = 0, g = 0, b = 0, v = 0, a = 0)
19
+ @kb_colors.add_color(r,g,b,v,a)
20
+ end
21
+
22
+ def to_qrcode
23
+ qr = RQRCode::QRCode.new(@kb_colors.to_s, :size => 14 , :level => 'h')
24
+ png = qr.to_img
25
+ png.resize(360,360).save(@filename)
26
+ end
27
+
28
+ def to_img
29
+ RQRCode::QRCode.new(@kb_colors.to_s, :size => 14 , :level => 'h').to_img
30
+ end
31
+ end
32
+
33
+ # Your code goes here...
34
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rqrcode_kingblade/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rqrcode_kingblade"
8
+ spec.version = RqrcodeKingblade::VERSION
9
+ spec.authors = ["inpwjp"]
10
+ spec.email = ["inpw@mua.biglobe.ne.jp"]
11
+ spec.license = "MIT"
12
+
13
+ spec.summary = %q{make qrcode for the kingblade III.}
14
+ spec.description = %q{make qrcode for the kingblade III.}
15
+ spec.homepage = "https://github.com/inpwjp/rqrcode_kingblade"
16
+
17
+ 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"]
21
+
22
+ spec.add_dependency 'rqrcode_png'
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.9"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rqrcode_kingblade
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - inpwjp
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-09-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rqrcode_png
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.9'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.9'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: make qrcode for the kingblade III.
56
+ email:
57
+ - inpw@mua.biglobe.ne.jp
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".travis.yml"
64
+ - Gemfile
65
+ - Guardfile
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - lib/kb_color.rb
71
+ - lib/kb_colors.rb
72
+ - lib/rqrcode_kingblade.rb
73
+ - lib/rqrcode_kingblade/version.rb
74
+ - rqrcode_kingblade.gemspec
75
+ homepage: https://github.com/inpwjp/rqrcode_kingblade
76
+ licenses:
77
+ - MIT
78
+ metadata: {}
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubyforge_project:
95
+ rubygems_version: 2.4.5
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: make qrcode for the kingblade III.
99
+ test_files: []