amida 0.0.2 → 0.0.3

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.
@@ -1,8 +1,5 @@
1
1
  rvm:
2
- - 1.8.7
3
2
  - 1.9.2
4
3
  - 1.9.3
5
4
  - ruby-head
6
- - jruby
7
- - rbx-18mode
8
5
  - rbx-19mode
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Amida
2
2
 
3
- A Generator Amidakuji
3
+ A Generator of Amidakuji
4
4
 
5
5
  ## Installation
6
6
 
@@ -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 27 and under" if width > 26
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
- ' ' + (@content.join(' ')) + ' '
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
@@ -18,7 +18,8 @@ module Amida
18
18
  end
19
19
 
20
20
  def to_s
21
- @content.join(' ')
21
+ content = @content.map{|s| s == '!!!' ? "\e[33m" + s + "\e[0m" : s}
22
+ content.join(' ')
22
23
  end
23
24
  end
24
25
  end
@@ -1,3 +1,3 @@
1
1
  module Amida
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -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 == ' A B C D E ' }
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 == " A B C D E \n" }
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
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Amida::Prize do
4
4
  context 'width == 5' do
5
5
  let(:prize) { Amida::Prize.new(5) }
6
- let(:correct_result) { ' !!! ' }
6
+ let(:correct_result) { " \e[33m!!!\e[0m " }
7
7
 
8
8
  describe '#to_s' do
9
9
  context 'when prize index == 1' do
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.2
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-04 00:00:00.000000000 Z
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: &70280502416160 !ruby/object:Gem::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: *70280502416160
24
+ version_requirements: *70221257562840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70280502415660 !ruby/object:Gem::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: *70280502415660
35
+ version_requirements: *70221257562140
36
36
  description: Amida drawing
37
37
  email:
38
38
  - yuki@gnnk.net