transparent_nil 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/License.txt CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- == License For Kyanite
2
+ == License For TransparentNil
3
3
  Creative Commons Attribution-Share Alike 3.0 Germany
4
4
 
5
5
  (cc-by-sa) http://creativecommons.org/licenses/by-sa/3.0/de/deed.en
data/README.txt CHANGED
@@ -3,9 +3,25 @@
3
3
 
4
4
  http://bklippstein.github.com/transparent_nil/
5
5
 
6
-
7
- == Features
8
- * Transparent nil Handling, see NilClass
6
+ nil values can be quite annoying. Although it is a nice error indicator but you're source code
7
+ gets ugly with too many conditional statements that handle the nil case.
8
+  
9
+ TransparentNil defines some methods for +nil+ so nil values behave like any other object. Most of them return just nil, but some are different:
10
+ nil.empty?
11
+ > true
12
+
13
+ nil << [element]
14
+ > [element]
15
+
16
+ nil.size
17
+ > 0
18
+
19
+ nil.split(//)
20
+ > []
21
+
22
+ Think +nil+ als "nothing". You can ask for nil if you need to, but you don't have to do it so often.
23
+
24
+ The Kyanite gem extends the usage of nil.
9
25
 
10
26
 
11
27
 
data/Rakefile.rb CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  require 'kyanite/smart_load_path'
4
4
  smart_load_path
5
- require 'kyanite/hoe'
6
- require 'kyanite/string'
7
- Kyanite.projectname = File.dirname(__FILE__).split("/")[-1].strip # Name des Projekt-Stammverzeichnisses
8
- Kyanite.github_username = 'bklippstein'
5
+
6
+ require 'drumherum'
7
+ Drumherum.project_name = File.dirname(__FILE__).split("/")[-1].strip # Name des Projekt-Stammverzeichnisses
8
+ Drumherum.github_username = 'bklippstein'
9
9
  require 'rdoc/task'
10
- require 'kyanite/rake'
10
+ require 'drumherum/rake'
11
11
 
12
12
  require 'transparent_nil'
13
13
 
@@ -18,16 +18,16 @@ require 'transparent_nil'
18
18
  #
19
19
  # http://nubyonrails.com/articles/tutorial-publishing-rubygems-with-hoe
20
20
  #
21
- $hoe = Hoe.spec Kyanite.projectname do
21
+ $hoe = Hoe.spec Drumherum.project_name do
22
22
 
23
23
  # self.rubyforge_name = 'yourgemx' # if different than 'yourgem'
24
24
 
25
25
  developer('Bjoern Klippstein', 'klippstein@klippstein.com')
26
- summary = 'Transparent Nil'
27
- # extra_deps << ['kyanite', '>= 0.5.17']
26
+ summary = 'Nil values can be quite annoying. TransparentNil defines some methods for +nil+ so nil values behave like any other object.'
27
+ extra_dev_deps << ['drumherum', '>= 0.1.0']
28
28
 
29
29
  remote_rdoc_dir = '' # Release to root only one project
30
- urls = [["http://#{Kyanite.github_username}.github.com/#{Kyanite.projectname}/"]]
30
+ urls = [["http://#{Drumherum.github_username}.github.com/#{Drumherum.project_name}/"]]
31
31
 
32
32
 
33
33
  end
@@ -51,7 +51,7 @@ remove_task 'docs'
51
51
  desc "generate RDoc documentation"
52
52
  Rake::RDocTask.new(:docs) do |rd|
53
53
 
54
- rd.title = "#{Kyanite.projectname.capitalize} #{Kyanite.projectname.to_class.const_get('VERSION')}"
54
+ rd.title = "#{Drumherum.project_class.to_s} #{Drumherum.project_version}"
55
55
 
56
56
  rd.rdoc_dir = 'doc'
57
57
  rd.rdoc_files.include('lib/**/*.rb')
@@ -1,18 +1,7 @@
1
1
  # ruby encoding: utf-8
2
2
  # ü
3
3
 
4
- puts 'required TransparentNil::nil.rb'
5
-
6
-
7
- # == Transparent Nil
8
- # Nil nervt oft. Zwar ist es ein schöner Fehlerindikator
9
- # (meist läuft irgendwas schief wenn man es unerwartet mit nil zu tun hat)
10
- # aber man verunstaltet seinen Quellcode schnell mit Fallunterscheidungen, die den nil-Fall behandeln.
11
- #
12
- # In Kyanite werden daher zahlreiche Methoden für nil definiert.
13
- # Nil verhält sich damit wie alle anderen Objekte auch.
14
- # Man kann immer noch nach Nil fragen, wenn man es möchte, aber man muss es nicht mehr tun!
15
- #
4
+
16
5
  module TransparentNil
17
6
 
18
7
  # Rückgabe: Array mit dem einen Element
@@ -6,11 +6,11 @@ else
6
6
  $:.unshift(File.dirname(__FILE__))
7
7
  end
8
8
 
9
- puts 'required transparent_nil.rb'
9
+ puts 'Using TransparentNil'
10
10
 
11
11
  module TransparentNil #:nodoc
12
12
 
13
- VERSION = '0.1.2'
13
+ VERSION = '0.1.4'
14
14
 
15
15
  end
16
16
 
data/test/test_nil.rb CHANGED
@@ -5,8 +5,8 @@ if $0 == __FILE__
5
5
  smart_load_path
6
6
  end
7
7
 
8
- require 'kyanite/unit_test'
9
- require 'kyanite/general/nil'
8
+ require 'drumherum/unit_test'
9
+ require 'transparent_nil'
10
10
 
11
11
  # Tests for NilClass
12
12
  class TestTransparentNil < UnitTest
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transparent_nil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: '3.10'
30
+ - !ruby/object:Gem::Dependency
31
+ name: drumherum
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 0.1.0
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.1.0
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: hoe
32
48
  requirement: !ruby/object:Gem::Requirement