Now supports Numeric
This commit is contained in:
parent
f07073131b
commit
2c53b6e423
|
@ -0,0 +1,5 @@
|
||||||
|
lib/**/*.rb
|
||||||
|
bin/*
|
||||||
|
-
|
||||||
|
features/**/*.feature
|
||||||
|
LICENSE.txt
|
|
@ -0,0 +1,48 @@
|
||||||
|
# rcov generated
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# rdoc generated
|
||||||
|
rdoc
|
||||||
|
|
||||||
|
# yard generated
|
||||||
|
doc
|
||||||
|
.yardoc
|
||||||
|
|
||||||
|
# bundler
|
||||||
|
.bundle
|
||||||
|
|
||||||
|
# jeweler generated
|
||||||
|
pkg
|
||||||
|
|
||||||
|
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
||||||
|
#
|
||||||
|
# * Create a file at ~/.gitignore
|
||||||
|
# * Include files you want ignored
|
||||||
|
# * Run: git config --global core.excludesfile ~/.gitignore
|
||||||
|
#
|
||||||
|
# After doing this, these files will be ignored in all your git projects,
|
||||||
|
# saving you from having to 'pollute' every project you touch with them
|
||||||
|
#
|
||||||
|
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
||||||
|
#
|
||||||
|
# For MacOS:
|
||||||
|
#
|
||||||
|
#.DS_Store
|
||||||
|
|
||||||
|
# For TextMate
|
||||||
|
#*.tmproj
|
||||||
|
#tmtags
|
||||||
|
|
||||||
|
# For emacs:
|
||||||
|
#*~
|
||||||
|
#\#*
|
||||||
|
#.\#*
|
||||||
|
|
||||||
|
# For vim:
|
||||||
|
#*.swp
|
||||||
|
|
||||||
|
# For redcar:
|
||||||
|
#.redcar
|
||||||
|
|
||||||
|
# For rubinius:
|
||||||
|
#*.rbc
|
|
@ -0,0 +1,15 @@
|
||||||
|
source "http://rubygems.org"
|
||||||
|
# Add dependencies required to use your gem here.
|
||||||
|
# Example:
|
||||||
|
# gem "activesupport", ">= 2.3.5"
|
||||||
|
|
||||||
|
# Add dependencies to develop your gem here.
|
||||||
|
# Include everything needed to run rake, tests, features, etc.
|
||||||
|
group :development do
|
||||||
|
gem "rdoc", ">= 0"
|
||||||
|
gem "rspec", "~> 2.3.0"
|
||||||
|
gem "cucumber", ">= 0"
|
||||||
|
gem "bundler", "~> 1.0.0"
|
||||||
|
gem "jeweler", "~> 1.6.4"
|
||||||
|
gem "rcov", ">= 0"
|
||||||
|
end
|
|
@ -0,0 +1,42 @@
|
||||||
|
GEM
|
||||||
|
remote: http://rubygems.org/
|
||||||
|
specs:
|
||||||
|
builder (3.0.0)
|
||||||
|
cucumber (1.0.2)
|
||||||
|
builder (>= 2.1.2)
|
||||||
|
diff-lcs (>= 1.1.2)
|
||||||
|
gherkin (~> 2.4.5)
|
||||||
|
json (>= 1.4.6)
|
||||||
|
term-ansicolor (>= 1.0.5)
|
||||||
|
diff-lcs (1.1.2)
|
||||||
|
gherkin (2.4.5)
|
||||||
|
json (>= 1.4.6)
|
||||||
|
git (1.2.5)
|
||||||
|
jeweler (1.6.4)
|
||||||
|
bundler (~> 1.0)
|
||||||
|
git (>= 1.2.5)
|
||||||
|
rake
|
||||||
|
json (1.5.3)
|
||||||
|
rake (0.9.2)
|
||||||
|
rcov (0.9.9)
|
||||||
|
rdoc (3.8)
|
||||||
|
rspec (2.3.0)
|
||||||
|
rspec-core (~> 2.3.0)
|
||||||
|
rspec-expectations (~> 2.3.0)
|
||||||
|
rspec-mocks (~> 2.3.0)
|
||||||
|
rspec-core (2.3.1)
|
||||||
|
rspec-expectations (2.3.0)
|
||||||
|
diff-lcs (~> 1.1.2)
|
||||||
|
rspec-mocks (2.3.0)
|
||||||
|
term-ansicolor (1.0.6)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
ruby
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
bundler (~> 1.0.0)
|
||||||
|
cucumber
|
||||||
|
jeweler (~> 1.6.4)
|
||||||
|
rcov
|
||||||
|
rdoc
|
||||||
|
rspec (~> 2.3.0)
|
|
@ -0,0 +1,20 @@
|
||||||
|
Copyright (c) 2011 Gregory Eremin
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,77 @@
|
||||||
|
______ __ __ ______ ______ ______ ______ ______
|
||||||
|
/\ ___\ /\ \/\ \ /\ == \ /\___ \ /\ ___\ /\ == \ /\ __ \
|
||||||
|
\ \___ \ \ \ \_\ \ \ \ __< \/_/ /__ \ \ __\ \ \ __< \ \ \/\ \
|
||||||
|
\/\_____\ \ \_____\ \ \_____\ /\_____\ \ \_____\ \ \_\ \_\ \ \_____\
|
||||||
|
\/_____/ \/_____/ \/_____/ \/_____/ \/_____/ \/_/ /_/ \/_____/
|
||||||
|
|
||||||
|
|
||||||
|
Yeah, he IS awesome!
|
||||||
|
|
||||||
|
tjG###
|
||||||
|
tjfG###j::#
|
||||||
|
tjfLE###LLDWLi
|
||||||
|
,jfE##KW###fi.; :W
|
||||||
|
jD###KKKW###ft::,WWt
|
||||||
|
tL###KKKK#### EDi iWWDt
|
||||||
|
###KGGEW#WK# KE#GWjLjt
|
||||||
|
Di#KLLK###KW LK#fWiftit
|
||||||
|
#Gj#EDK##WEK DW G iD E;
|
||||||
|
#K#ffKW##WEK# K# E tG D; WWWKK
|
||||||
|
#E#LG###WEK## fK ## KW fj KKKKKKKK
|
||||||
|
#K##EE##WK#### W### K# WWKKDEKKEK
|
||||||
|
#W###EEDEWW#WKW W ###WKGDEKEEW
|
||||||
|
K#####WWW#KWDLLD# LE ##KKKEGDEKEE#
|
||||||
|
EK#####KDDEj;,;if##GGGE ###KK#KDDEKKDW
|
||||||
|
EEKWEEDDDti: .;tEDfWWfLG ###KDWWKKKKKEK#
|
||||||
|
KEDEDGfEjt;. ,tD#WDjEKLLj ####KK##W##WKK#
|
||||||
|
WEDfijDGLji,,tGGWGjjftWjtj ###############
|
||||||
|
KKDjiGEDLfjtfDjEitifftGttt ##########W####
|
||||||
|
DWEjfEKEDLLfEjj;iittii;Wtf ################
|
||||||
|
DWDLDKWKDGG#KfiiiitiitjWiLK#######GLjj:ijGD
|
||||||
|
GWEDEKKKDDEWiiiiiiittjj#E#######fLfiji;fjf
|
||||||
|
EWKKEWWKEtDiiiiiiiiiif#######L#fE###GGGLE
|
||||||
|
KWKKKKKEitiiiiiiiiiiW#######jijjEW#####
|
||||||
|
WWKKWWLtiiiiiiiiiL########j,i:jDWEG#
|
||||||
|
WWWjiiiiiiii;L###WK###Lf,tijjDjK
|
||||||
|
GW#GEjiiiiiiL####WE###ELf,fDfjfjf
|
||||||
|
j####iEitii;j###K#KW###EGf,,:;t:j
|
||||||
|
######WtW;KE###WK#K###EKWffjGWEE
|
||||||
|
W#ft####EiEK####KK####EDDLfffDG
|
||||||
|
W#:t:;K#EED######W####EGGLDDDEWf
|
||||||
|
i#tjff:;#EK#####WW#####EGLGDEKf;W
|
||||||
|
jftjffji;###############EDGGDDttiKj
|
||||||
|
j;ijffjtL################EEDDtii;;iE
|
||||||
|
D,tjffff#################WWDfiitiit:Wt
|
||||||
|
#ttjffff################EKGftttt;ii,WWLf
|
||||||
|
i#iijfLfE###############ffjjititiii;jWi## :iiGft
|
||||||
|
i#iijfff##############fKftiti;;,,,:LW;### ;,;j;.;ij;t
|
||||||
|
G#ifjffD##############WEKL;;,,,,,,jW;### :;W##,j###E,
|
||||||
|
t#jW#fGDW#############i:i##Ej;,,:LWiWEE# :iE####L#t
|
||||||
|
Di:iE##E##############tti:W##fjtfWt#GGD# ;fG#######Gj
|
||||||
|
f,:tjiW##############tjjtt;E##LfWfWGfifK itE#####W##Gi
|
||||||
|
::,tjtj#############Wffffff;L##DLKDji;tE #W### Gf
|
||||||
|
:,,tttj#############ffffffff:#EG#Eji,:,j ##K### tE
|
||||||
|
:,,ttjL############ELLLfffffDWf#WDt;. :iL #K###W fi
|
||||||
|
:,ijtjG############GGLLGLLLDWf###Gj,. ;tL #K##WK K
|
||||||
|
:;itjjD############EGGGGGGGWf###WDfi;..,ijKWK##WE
|
||||||
|
:ittjfE#############EGDDDDEL#####KGjt;,;tt#K###EE
|
||||||
|
:ttjfLE##########ti###DDEEWE####WWDLjtiij##K###KE
|
||||||
|
:,jjffK##########fEEEWWKEEW#####KKKDLjjfE#KW##WEE
|
||||||
|
;,tjfLK#########jEEEWWWW########WEEEEEEW#KE###EGG
|
||||||
|
,,,jfLE#########EEEEKWWWW##W#####EGGDWWGWEK###DGE
|
||||||
|
:;jfGK########GEEEEKWWW#E###WW##KGfj;;LKE####DEE
|
||||||
|
:,tLDE########EEEEEEWWWED##### #DLj;tff#####ED
|
||||||
|
,,tLDE#######WEKGGEEWWGD##### KGfjj#LGE#WEDE
|
||||||
|
,ifGE#######LLDGGDEWGDD#### #EGLG#EEEE#WD#
|
||||||
|
;ifDE######EGEDDGGLffLW### WKGE###EE####
|
||||||
|
,G;fEE######GEDDDDGGLfE#### KDD########
|
||||||
|
jWjGKW#####ELGDDDGGfLDW### KK########
|
||||||
|
E##fLL#####DGGGGGGLLfD### K########
|
||||||
|
G##K#WfEfD#EGDGGGLLLGE## #W######
|
||||||
|
iL############EGGDDEE#WE ####W
|
||||||
|
tLjj##################KEW ##
|
||||||
|
;tGW,,L###############GKK
|
||||||
|
tjfWjfDLi,,G#########DfWEW
|
||||||
|
,jtfWjtfLGLLLjiWWEEWWWLEEEW
|
||||||
|
jijjLjjffffttt:WWEKWEWWWKGW
|
||||||
|
|
63
Rakefile
63
Rakefile
|
@ -1,15 +1,52 @@
|
||||||
require "rubygems"
|
# encoding: utf-8
|
||||||
|
|
||||||
spec = Gem::Specification.new do |s|
|
|
||||||
|
|
||||||
s.name = "subzero"
|
|
||||||
s.version = "0.1.0"
|
|
||||||
s.summary = "Totally awesome gem that extends Fixnum functionality"
|
|
||||||
s.description = "Adds one magic method to Fixnum class. Guest what method is it?"
|
|
||||||
s.authors = ["Gregory Eremin"]
|
|
||||||
s.email = "chez@vim.me"
|
|
||||||
s.homepage = "https://github.com/magnolia-fan/subzero"
|
|
||||||
|
|
||||||
s.require_paths = ["lib"]
|
|
||||||
|
|
||||||
|
require 'rubygems'
|
||||||
|
require 'bundler'
|
||||||
|
begin
|
||||||
|
Bundler.setup(:default, :development)
|
||||||
|
rescue Bundler::BundlerError => e
|
||||||
|
$stderr.puts e.message
|
||||||
|
$stderr.puts "Run `bundle install` to install missing gems"
|
||||||
|
exit e.status_code
|
||||||
|
end
|
||||||
|
require 'rake'
|
||||||
|
|
||||||
|
require 'jeweler'
|
||||||
|
Jeweler::Tasks.new do |gem|
|
||||||
|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
||||||
|
gem.name = "subzero"
|
||||||
|
gem.homepage = "http://github.com/magnolia-fan/subzero"
|
||||||
|
gem.license = "MIT"
|
||||||
|
gem.summary = %Q{Totally awesome gem that extends Fixnum functionality}
|
||||||
|
gem.description = %Q{Adds one magic method to the Numeric class. Guest what method is it?}
|
||||||
|
gem.email = "magnolia_fan@me.com"
|
||||||
|
gem.authors = ["Gregory Eremin"]
|
||||||
|
# dependencies defined in Gemfile
|
||||||
|
end
|
||||||
|
Jeweler::RubygemsDotOrgTasks.new
|
||||||
|
|
||||||
|
require 'rspec/core'
|
||||||
|
require 'rspec/core/rake_task'
|
||||||
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
||||||
|
spec.pattern = FileList['spec/**/*_spec.rb']
|
||||||
|
end
|
||||||
|
|
||||||
|
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
||||||
|
spec.pattern = 'spec/**/*_spec.rb'
|
||||||
|
spec.rcov = true
|
||||||
|
end
|
||||||
|
|
||||||
|
require 'cucumber/rake/task'
|
||||||
|
Cucumber::Rake::Task.new(:features)
|
||||||
|
|
||||||
|
task :default => :spec
|
||||||
|
|
||||||
|
require 'rdoc/task'
|
||||||
|
RDoc::Task.new do |rdoc|
|
||||||
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
||||||
|
|
||||||
|
rdoc.rdoc_dir = 'rdoc'
|
||||||
|
rdoc.title = "subzero #{version}"
|
||||||
|
rdoc.rdoc_files.include('README*')
|
||||||
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||||
end
|
end
|
|
@ -0,0 +1,9 @@
|
||||||
|
Feature: something something
|
||||||
|
In order to something something
|
||||||
|
A user something something
|
||||||
|
something something something
|
||||||
|
|
||||||
|
Scenario: something something
|
||||||
|
Given inspiration
|
||||||
|
When I create a sweet new gem
|
||||||
|
Then everyone should see how awesome I am
|
|
@ -0,0 +1,13 @@
|
||||||
|
require 'bundler'
|
||||||
|
begin
|
||||||
|
Bundler.setup(:default, :development)
|
||||||
|
rescue Bundler::BundlerError => e
|
||||||
|
$stderr.puts e.message
|
||||||
|
$stderr.puts "Run `bundle install` to install missing gems"
|
||||||
|
exit e.status_code
|
||||||
|
end
|
||||||
|
|
||||||
|
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
||||||
|
require 'subzero'
|
||||||
|
|
||||||
|
require 'rspec/expectations'
|
|
@ -1,4 +1,4 @@
|
||||||
class Fixnum
|
class Numeric
|
||||||
def subzero?
|
def subzero?
|
||||||
self < 0
|
self < 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
||||||
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
||||||
|
require 'rspec'
|
||||||
|
require 'subzero'
|
||||||
|
|
||||||
|
# Requires supporting files with custom matchers and macros, etc,
|
||||||
|
# in ./support/ and its subdirectories.
|
||||||
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,14 @@
|
||||||
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
||||||
|
|
||||||
|
describe "Number" do
|
||||||
|
it "should be subzero" do
|
||||||
|
-1.subzero?.should == true
|
||||||
|
-0.123.subzero?.should == true
|
||||||
|
-1000.subzero?.should == true
|
||||||
|
end
|
||||||
|
it "should be uncool" do
|
||||||
|
0.subzero?.should == false
|
||||||
|
1.subzero?.should == false
|
||||||
|
0.123.subzero?.should == false
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,15 +0,0 @@
|
||||||
Gem::Specification.new do |s|
|
|
||||||
|
|
||||||
s.name = %q{subzero}
|
|
||||||
s.version = "0.1.0"
|
|
||||||
|
|
||||||
s.authors = ["Gregory Eremin"]
|
|
||||||
s.date = %q{2011-06-30}
|
|
||||||
s.email = %q{chez@vim.me}
|
|
||||||
s.files = ["lib/subzero.rb"]
|
|
||||||
s.homepage = %q{https://github.com/magnolia-fan/subzero}
|
|
||||||
s.require_paths = ["lib"]
|
|
||||||
s.summary = %q{Totally awesome gem that extends Fixnum functionality}
|
|
||||||
s.description = %q{Adds one magic method to Fixnum class. Guest what method is it?}
|
|
||||||
|
|
||||||
end
|
|
Loading…
Reference in New Issue