trimmy 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.2@trimmy
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in trimmy.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ # Trimmy
2
+
3
+ Trimmy is a trivial gem adding a trim method to strings that removes all
4
+ whitespaces like php's trim method.
5
+
6
+ No magic, just a regex but that's annoying writing it all the times!
7
+
8
+ ## Installation
9
+
10
+ ```
11
+ gem install trimmy
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```
17
+ require 'trimmy'
18
+
19
+ " this is a string with a lot of whitespaces ".trim # => "thisisastringwithalotofwhitespaces"
20
+ ```
21
+
22
+ Enjoy it!
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+ task :default => :spec
7
+ task :test => :spec
@@ -0,0 +1,7 @@
1
+ require "trimmy/version"
2
+
3
+ class String
4
+ def trim
5
+ self.gsub(/\s+/, "")
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module Trimmy
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1 @@
1
+ require 'trimmy'
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Trimmy will help you in trim withspaces from string" do
4
+ it "leaves string without whitespace untouched" do
5
+ "thisisastring".trim.should == "thisisastring"
6
+ end
7
+
8
+ it "removes heading whitespaces" do
9
+ " thisisastring".trim.should == "thisisastring"
10
+ end
11
+
12
+ it "removes trailing whitespaces" do
13
+ "thisisastring ".trim.should == "thisisastring"
14
+ end
15
+ it "removes all whitespaces" do
16
+ " this is a string ".trim.should == "thisisastring"
17
+ end
18
+ end
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "trimmy/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "trimmy"
7
+ s.version = Trimmy::VERSION
8
+ s.authors = ["Paolo Perego"]
9
+ s.email = ["thesp0nge@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{add to String class a trim method removing all whitespaces}
12
+ s.description = %q{add to String class a trim method removing all whitespaces}
13
+
14
+ s.rubyforge_project = "trimmy"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_development_dependency 'rake'
22
+ s.add_development_dependency 'rspec'
23
+
24
+ # specify any dependencies here; for example:
25
+ # s.add_development_dependency "rspec"
26
+ # s.add_runtime_dependency "rest-client"
27
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: trimmy
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Paolo Perego
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-04 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: &70333202364800 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70333202364800
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &70333202364380 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70333202364380
36
+ description: add to String class a trim method removing all whitespaces
37
+ email:
38
+ - thesp0nge@gmail.com
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files: []
42
+ files:
43
+ - .gitignore
44
+ - .rvmrc
45
+ - Gemfile
46
+ - README.md
47
+ - Rakefile
48
+ - lib/trimmy.rb
49
+ - lib/trimmy/version.rb
50
+ - spec/spec_helper.rb
51
+ - spec/trimmy_spec.rb
52
+ - trimmy.gemspec
53
+ homepage: ''
54
+ licenses: []
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project: trimmy
73
+ rubygems_version: 1.8.10
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: add to String class a trim method removing all whitespaces
77
+ test_files:
78
+ - spec/spec_helper.rb
79
+ - spec/trimmy_spec.rb