amida 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +0 -3
- data/README.md +1 -1
- data/lib/amida/label.rb +3 -2
- data/lib/amida/prize.rb +2 -1
- data/lib/amida/version.rb +1 -1
- data/spec/amida/label_spec.rb +2 -2
- data/spec/amida/prize_spec.rb +1 -1
- metadata +6 -6
data/.travis.yml
CHANGED
data/README.md
CHANGED
data/lib/amida/label.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Amida
|
2
2
|
class Label
|
3
3
|
def initialize(width)
|
4
|
-
raise ArgumentError, "Width of Amida has to be
|
4
|
+
raise ArgumentError, "Width of Amida has to be 26 and under" if width > 26
|
5
5
|
@content = ('A'..'Z').to_a[0..width-1]
|
6
6
|
end
|
7
7
|
|
@@ -11,7 +11,8 @@ module Amida
|
|
11
11
|
|
12
12
|
private
|
13
13
|
def to_s
|
14
|
-
|
14
|
+
content = @content.map.with_index{|s,i| "\e[#{i%5 < 2 ? i%5 + 31 : i%5 + 32}m" + s + "\e[0m"}
|
15
|
+
' ' + (content.join(' ')) + ' '
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
data/lib/amida/prize.rb
CHANGED
data/lib/amida/version.rb
CHANGED
data/spec/amida/label_spec.rb
CHANGED
@@ -9,11 +9,11 @@ describe Amida::Label do
|
|
9
9
|
let(:label) { Amida::Label.new(5) }
|
10
10
|
|
11
11
|
describe '#to_s' do
|
12
|
-
it { label.send(:to_s).should ==
|
12
|
+
it { label.send(:to_s).should == " \e[31mA\e[0m \e[32mB\e[0m \e[34mC\e[0m \e[35mD\e[0m \e[36mE\e[0m " }
|
13
13
|
end
|
14
14
|
|
15
15
|
describe '#render' do
|
16
|
-
it { capture(:stdout){ label.render }.should == "
|
16
|
+
it { capture(:stdout){ label.render }.should == " \e[31mA\e[0m \e[32mB\e[0m \e[34mC\e[0m \e[35mD\e[0m \e[36mE\e[0m \n" }
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/spec/amida/prize_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amida
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70221257562840 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2.9'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70221257562840
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70221257562140 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 0.9.2
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70221257562140
|
36
36
|
description: Amida drawing
|
37
37
|
email:
|
38
38
|
- yuki@gnnk.net
|