faetr 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/faetr.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{faetr}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bodaniel Jeanes", "Jack Chen"]
@@ -24,6 +24,12 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "VERSION",
26
26
  "faetr.gemspec",
27
+ "lib/faetr.rb",
28
+ "lib/faetr/array_ext.rb",
29
+ "lib/faetr/class_ext.rb",
30
+ "lib/faetr/range_ext.rb",
31
+ "lib/faetr/symbol_ext.rb",
32
+ "lib/faetr/warn_define.rb",
27
33
  "spec/faetr_spec.rb",
28
34
  "spec/spec_helper.rb"
29
35
  ]
@@ -0,0 +1,14 @@
1
+ # ["ID", "TITLE"].collect(&[:downcase, :to_sym]) # => [:id, :title]
2
+ class Array
3
+ warn_define :to_proc do
4
+ Proc.new do |item|
5
+ inject(item) do |mem, obj|
6
+ mem.send(obj)
7
+ end
8
+ end
9
+ end
10
+
11
+ warn_define :rand do
12
+ self[Kernel.rand(size)]
13
+ end
14
+ end
@@ -0,0 +1,2 @@
1
+ class Class
2
+ end
@@ -0,0 +1,6 @@
1
+ class Range
2
+ # TODO: make this be a no-op for Time/Dates
3
+ warn_define :rand do
4
+ to_a.rand # not optimized, but will work regardless of range time
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class Symbol
2
+ warn_define :to_proc do
3
+ Proc.new { |item| item.send self }
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ class Class
2
+ def warn_define(method, &block)
3
+ if instance_methods.include?(method.to_s)
4
+ $stderr.puts "#{self.inspect}##{method.to_s} is already defined"
5
+ else
6
+ define_method(method, &block)
7
+ end
8
+ end
9
+ end
data/lib/faetr.rb ADDED
@@ -0,0 +1,2 @@
1
+ require "lib/warn_define"
2
+ Dir['faetr/*_ext.rb'].each {|lib| require lib}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faetr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bodaniel Jeanes
@@ -40,6 +40,12 @@ files:
40
40
  - Rakefile
41
41
  - VERSION
42
42
  - faetr.gemspec
43
+ - lib/faetr.rb
44
+ - lib/faetr/array_ext.rb
45
+ - lib/faetr/class_ext.rb
46
+ - lib/faetr/range_ext.rb
47
+ - lib/faetr/symbol_ext.rb
48
+ - lib/faetr/warn_define.rb
43
49
  - spec/faetr_spec.rb
44
50
  - spec/spec_helper.rb
45
51
  has_rdoc: true