just_include 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5bb531492e160e40e8e543e7ccbf5d25de4dc43d
4
+ data.tar.gz: 1595543fbe14a3d2ec13ca4ac94c54f55fdee9d8
5
+ SHA512:
6
+ metadata.gz: faa5ce12dc073bd0f616ff1d894ce1dd14ba9293561c3f3916065f3e90f12e44b77e924f0be012279e754612d8e41e4286f3b867c3624786751a2b2211d4f53c
7
+ data.tar.gz: 07fabcfa8cbc9defa224120f30c31bae03723b9da3b9e40bf5c30948c6e0576440f7635f5c005d9563f61897595e45b8b83faa45501aeda19b0306ff0ea4c111
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .idea
6
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in dynopoker.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,58 @@
1
+ JustInclude
2
+ =============
3
+
4
+ JustInclude simply wraps included { class_eval { ... } } combo.
5
+ class_eval is better then normal method ClassMethods because you can include all kind of things you normally type inside a class. Such as:
6
+ - methods
7
+ - class methods
8
+ - callbacks
9
+ - relation definitions
10
+ - act_as_*
11
+ - constans
12
+ - extends / includes
13
+ etc...
14
+
15
+
16
+ Usecase
17
+ -------
18
+ I was working on a large app where core functionality was searching.
19
+ I decided that methods related with solr so `searchable` and wrapper on solr search are so important in my app, that they deserve to have their own file.
20
+ From class point of view, functionality sill belongs to that class.
21
+
22
+
23
+ Installation
24
+ -------
25
+
26
+ gem 'just_include'
27
+
28
+
29
+ Usage
30
+ -----
31
+ Create a module with functionality you want to be part of other class
32
+
33
+ module FunctionalityA
34
+ include JustInclude
35
+ just_include do
36
+
37
+ extend FriendlyId
38
+
39
+ acts_as_taggable_on :skills
40
+
41
+ searchable do
42
+ end
43
+
44
+ def method
45
+ end
46
+
47
+ def self.class_method
48
+ end
49
+
50
+ end
51
+ end
52
+
53
+ Then simply include this module inside other class
54
+
55
+ class OtherClass < ActiveRecord::Base
56
+ include FunctionalityA
57
+ end
58
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "just_include/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "just_include"
7
+ s.version = JustInclude::VERSION
8
+ s.authors = ["kubenstein"]
9
+ s.email = ["kubenstein@gmail.com"]
10
+ s.homepage = "https://github.com/kubenstein/just_include"
11
+ s.summary = %q{Simplify including functionality from module to class}
12
+ s.description = %q{With JustInclude you can include all kind of things from module to class, such as: methods, class methods, callbacks, relation definitions, act_as_*, constans, extends/includes, etc...}
13
+
14
+ s.rubyforge_project = "just_include"
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
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+ end
@@ -0,0 +1,2 @@
1
+ require "just_include/version"
2
+ require "just_include/just_include"
@@ -0,0 +1,18 @@
1
+ # JustInclude
2
+ # see homepage for more info:
3
+ # https://github.com/kubenstein/just_include
4
+
5
+ module JustInclude
6
+
7
+ def self.included(base)
8
+ base.extend(ActiveSupport::Concern)
9
+ base.extend(ClassMethods)
10
+ end
11
+
12
+ module ClassMethods
13
+ def just_include(&block)
14
+ included { class_eval(&block) }
15
+ end
16
+ end
17
+
18
+ end
@@ -0,0 +1,3 @@
1
+ module JustInclude
2
+ VERSION = "0.5.0"
3
+ end
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: just_include
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ platform: ruby
6
+ authors:
7
+ - kubenstein
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: 'With JustInclude you can include all kind of things from module to class,
14
+ such as: methods, class methods, callbacks, relation definitions, act_as_*, constans,
15
+ extends/includes, etc...'
16
+ email:
17
+ - kubenstein@gmail.com
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - README.md
25
+ - Rakefile
26
+ - just_include.gemspec
27
+ - lib/just_include.rb
28
+ - lib/just_include/just_include.rb
29
+ - lib/just_include/version.rb
30
+ homepage: https://github.com/kubenstein/just_include
31
+ licenses: []
32
+ metadata: {}
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubyforge_project: just_include
49
+ rubygems_version: 2.0.6
50
+ signing_key:
51
+ specification_version: 4
52
+ summary: Simplify including functionality from module to class
53
+ test_files: []