0.0
No commit activity in last 3 years
No release in over 3 years
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...
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 3
 Project Readme

JustInclude Build Status

JustInclude changes the way you define methods in included modules. Now you write stuff in your module as you would ctrl+c ctrl+v from class. No more ClassMethods nor Instance Methods. See Usage section for better understanding. You can include all kind of things you normally type inside a class. Such as:

  • methods
  • class methods
  • callbacks
  • relation definitions
  • act_as_*
  • constans
  • extends / includes etc...

JustInclude has zero external dependencies so can be used in pure ruby apps also, not only Rails.

Usecase

I was working on a large app where core functionality was searching. 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. From class point of view, functionality sill belongs to that class.

Installation

gem 'just_include'

Usage

Create a module with functionality you want to be part of other class

module FunctionalityA
# use Simply or JustInclude
#  (include JustInclude)::this_code do
   (include Simply)::this_code do

     extend FriendlyId

     acts_as_taggable_on :skills

     searchable do
     end

     def method
     end

     def self.class_method
     end

   end
end

Then simply include this module inside other class

class OtherClass < ActiveRecord::Base 
	include FunctionalityA
end

Old Syntax

If you prefer old, less fancy syntax, check out version v.1.0.0.