method_repository 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,20 +1,20 @@
1
1
  # MethodRepository [![BuildStatus](https://secure.travis-ci.org/kentaro/method_repository.png)](http://travis-ci.org/kentaro/method_repository)
2
2
 
3
- Extracting redandunt code and commonalizing it in a different way.
3
+ Extracting redundant code and commonalizing it in a different way.
4
4
 
5
5
  ## Problem
6
6
 
7
- To extract redandunt codes into a method to commonalize them is a usual strategy for OOP. It allows us to streamline our codes and modify at one stop even though the method is used at anywhere, anytimes.
7
+ To extract redundant codes into a method to commonalize them is a usual strategy for OOP. It allows us to streamline our codes and modify at one stop even though the method is used at anywhere, anytimes.
8
8
 
9
- I don't like when highly commonalized OOP structure disturbes me from quick tracing where such methods are defined. It's OOP's natural defect, I think. Once classed/modules are defined, it's inevitable that the classes/modules are inherited/included at anywhere we don't know.
9
+ I don't like when highly commonalized OOP structure disturbes me from quick tracing where such methods are defined. It's OOP's natural defect, I think. Once classes/modules are defined, it's inevitable that the classes/modules are inherited/included at anywhere we don't know.
10
10
 
11
- In that way, inheritance/inclusion-based OOP resembles `goto` programming; There's no clear reason why some classes/modules are inherited/included by another classes/modules. Even though there's some structural thought in your classes/modules design, such an excessively free inheritance/inclusion prevent them from grasping the whole code quickily.
11
+ In that way, inheritance/inclusion-based OOP resembles `goto` programming; There's no clear reason why some classes/modules are inherited/included by another classes/modules. Even though there's some structural thought in your classes/modules design, such an excessively free inheritance/inclusion prevent us from grasping the whole code quickily.
12
12
 
13
13
  ## Solution
14
14
 
15
- This library provides a "method repository" in which you can add your methods to commonalize redandunt codes here and there in your whole codes, which is just same as usual module usage. However, the methods you define in the "repository" will never be included automatically into other classes/modules unless not permitted explicitely.
15
+ This library provides a "method repository" in which you can add your methods to commonalize redundant codes here and there in your whole codes, which is just same as usual module usage. However, the methods you define in the "repository" will never be included automatically into other classes/modules unless not permitted explicitely.
16
16
 
17
- This is the point; There's no chance the methods in the "repository" appear at somewhere the "repository" don't know. To commonalize redanduncy is our intension, but we don't want the methods to be used where we don't know. The way this library provides solves the problem.
17
+ This is the point; There's no chance the methods in the "repository" appear at somewhere the "repository" don't know. To commonalize redundancy is our intension, but we don't want the methods to be used where we don't know. The way this library provides solves the problem.
18
18
 
19
19
  ## Usage
20
20
 
@@ -1,4 +1,4 @@
1
- require "method_repository/version"
1
+ require_relative "method_repository/version"
2
2
 
3
3
  module MethodRepository
4
4
  def self.included(base)
@@ -11,8 +11,7 @@ module MethodRepository
11
11
  klass_name = base.class.to_s == 'Class' ? base.to_s : base.class.to_s
12
12
 
13
13
  if (methods = @targets[klass_name])
14
- singleton_class = class << base; self; end
15
- singleton_class.class_eval do
14
+ base.singleton_class.class_eval do
16
15
  methods.each do |method|
17
16
  define_method method[:name], method[:block]
18
17
  end
@@ -1,3 +1,3 @@
1
1
  module MethodRepository
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
8
8
  gem.version = MethodRepository::VERSION
9
9
  gem.authors = ["Kentaro Kuribayashi"]
10
10
  gem.email = ["kentarok@gmail.com"]
11
- gem.description = %q{Extracting redandunt code and commonalizing it in a different way.}
12
- gem.summary = %q{Extracting redandunt code and commonalizing it in a different way}
11
+ gem.description = %q{Extracting redundant code and commonalizing it in a different way.}
12
+ gem.summary = %q{Extracting redundant code and commonalizing it in a different way}
13
13
  gem.homepage = "https://github.com/kentaro/method_repository"
14
14
 
15
15
  gem.required_ruby_version = '>= 1.9.2'
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require_relative '../spec_helper'
2
2
 
3
3
  describe MethodRepository do
4
4
  module Repository
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,4 @@
1
- $:.unshift File.expand_path("../../lib", __FILE__)
2
- require 'method_repository'
1
+ require_relative '../lib/method_repository'
3
2
 
4
3
  RSpec.configure do |config|
5
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: method_repository
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-02 00:00:00.000000000 Z
12
+ date: 2013-02-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -43,7 +43,7 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
- description: Extracting redandunt code and commonalizing it in a different way.
46
+ description: Extracting redundant code and commonalizing it in a different way.
47
47
  email:
48
48
  - kentarok@gmail.com
49
49
  executables: []
@@ -84,7 +84,7 @@ rubyforge_project:
84
84
  rubygems_version: 1.8.23
85
85
  signing_key:
86
86
  specification_version: 3
87
- summary: Extracting redandunt code and commonalizing it in a different way
87
+ summary: Extracting redundant code and commonalizing it in a different way
88
88
  test_files:
89
89
  - spec/lib/method_repository_spec.rb
90
90
  - spec/spec_helper.rb