fish 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b877d75ce88e3197de5a0c4ccc2e07c907a56727
4
+ data.tar.gz: b88a63b10ee1e7b96ce3048ba482e39e17188f9a
5
+ SHA512:
6
+ metadata.gz: cb3f90b6ca2fb24f117f1761a63d959c3f18d30792a3eefa37e72e804e54ae650d0a2959e2e0179bb1c74eed955e048a012b1d63dacce367d270da1daf15f313
7
+ data.tar.gz: 881eafa6b2fcbd990bcd9a9453d4ac82ac25e189e65d6ea4949343061d2a7a5e0edfbaa44bf9f97cbaa34fbbff0f1581923b594e766e444611b6a5d338105f76
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Fish.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'Fish/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'fish'
8
+ spec.version = Fish::VERSION
9
+ spec.authors = %w(walru5)
10
+ spec.email = %w(whitepoizon@gmail.com)
11
+ spec.description = 'A gem for printing ascii fish'
12
+ spec.summary = 'A gem for printing ascii fish'
13
+ spec.homepage = 'https://github.com/walru5/Fish'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = %w(lib)
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
+ end
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :development do
4
+ gem 'rspec'
5
+ gem 'rspec-core'
6
+ end
7
+
8
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # Fish
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ gem 'fish'
8
+
9
+ And then execute:
10
+
11
+ $ bundle
12
+
13
+ Or install it yourself as:
14
+
15
+ $ gem install fish
16
+
17
+ ## Usage
18
+
19
+ Fish.fish # '><(((°>'
20
+ Fish.fish(5) # '><(((((°>'
21
+ Fish.fish(3, false) # '<°)))><'
22
+ Fish.many_fish(3, 3, false) # ['<°)))><', '<°)))><', '<°)))><']
23
+ Fish.random_fish # returns random fish
24
+ Fish.is_fish?('<°)))><') # true
25
+
26
+ ## Contributing
27
+
28
+ 1. Fork it
29
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
30
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
31
+ 4. Push to the branch (`git push origin my-new-feature`)
32
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/lib/Fish.rb ADDED
@@ -0,0 +1,28 @@
1
+ require 'Fish/version'
2
+
3
+ module Fish
4
+ def self.fish(len = 3, looks_right = true)
5
+ if looks_right
6
+ "><#{'(' * len}°>"
7
+ else
8
+ "<°#{')' * len}><"
9
+ end
10
+ end
11
+
12
+ def self.many_fish(num, len = 3, looks_right = true)
13
+ a = []
14
+ num.times {a << fish(len, looks_right)}
15
+ return a
16
+ end
17
+
18
+ def self.is_fish?(str)
19
+ ret = false
20
+ ret = true if str.match(/><\(+°>/) != nil
21
+ ret = true if str.match(/<°\)+></) != nil
22
+ return ret
23
+ end
24
+
25
+ def self.random_fish(max_len = 10)
26
+ fish(1 + rand(max_len), rand(2) == 1)
27
+ end
28
+ end
@@ -0,0 +1,3 @@
1
+ module Fish
2
+ VERSION = '0.0.1'
3
+ end
data/test/fish_spec.rb ADDED
@@ -0,0 +1,30 @@
1
+ require 'rspec'
2
+ require_relative '../lib/Fish'
3
+
4
+ describe Fish do
5
+ it 'should return a fish with 3 length' do
6
+ Fish.fish.should == '><(((°>'
7
+ end
8
+
9
+ it 'should return a fish with 5 length' do
10
+ Fish.fish(5).should == '><(((((°>'
11
+ end
12
+
13
+ it 'should return a fish looking to the left with length 7' do
14
+ Fish.fish(7, false).should == '<°)))))))><'
15
+ end
16
+
17
+ it 'should return a fish array with 2 left-looking fishes' do
18
+ Fish.many_fish(2, 3, false).should == ['<°)))><', '<°)))><']
19
+ end
20
+
21
+ it 'should know if a string is a fish' do
22
+ Fish.is_fish?('test').should == false
23
+ Fish.is_fish?('<°))><').should == true
24
+ Fish.is_fish?('><(((°>').should == true
25
+ end
26
+
27
+ it 'should generate correct random fishes' do
28
+ Fish.is_fish?(Fish.random_fish).should == true
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fish
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - walru5
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: A gem for printing ascii fish
42
+ email:
43
+ - whitepoizon@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Fish.gemspec
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - lib/Fish.rb
55
+ - lib/Fish/version.rb
56
+ - test/fish_spec.rb
57
+ homepage: https://github.com/walru5/Fish
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.0.2
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: A gem for printing ascii fish
81
+ test_files:
82
+ - test/fish_spec.rb