Module: Hammock

Defined in:
lib/hammock.rb,
lib/hammock/scope.rb,
lib/hammock/utils.rb,
lib/hammock/logging.rb,
lib/hammock/suggest.rb,
lib/hammock/callback.rb,
lib/hammock/ajaxinate.rb,
lib/hammock/callbacks.rb,
lib/hammock/constants.rb,
lib/hammock/overrides.rb,
lib/hammock/route_for.rb,
lib/hammock/hamlink_to.rb,
lib/hammock/route_node.rb,
lib/hammock/route_step.rb,
lib/hammock/export_scope.rb,
lib/hammock/canned_scopes.rb,
lib/hammock/model_logging.rb,
lib/hammock/restful_actions.rb,
lib/hammock/restful_support.rb,
lib/hammock/model_attributes.rb,
lib/hammock/javascript_buffer.rb,
lib/hammock/restful_rendering.rb,
lib/hammock/resource_retrieval.rb,
lib/hammock/monkey_patches/hash.rb,
lib/hammock/route_drawing_hooks.rb,
lib/hammock/monkey_patches/array.rb,
lib/hammock/controller_attributes.rb,
lib/hammock/monkey_patches/logger.rb,
lib/hammock/monkey_patches/module.rb,
lib/hammock/monkey_patches/object.rb,
lib/hammock/monkey_patches/string.rb,
lib/hammock/monkey_patches/numeric.rb,
lib/hammock/resource_mapping_hooks.rb,
lib/hammock/monkey_patches/route_set.rb,
lib/hammock/monkey_patches/action_pack.rb,
lib/hammock/monkey_patches/active_record.rb

Defined Under Namespace

Modules: ActionControllerPatches, ActiveRecordPatches, Ajaxinate, ArrayPatches, BufferedLoggerPatches, Callbacks, CannedScopes, Constants, ControllerAttributes, ExportScope, HamlinkTo, HashPatches, JavascriptBuffer, Logging, ModelAttributes, ModelLogging, ModulePatches, NumericPatches, ObjectPatches, Overrides, ResourceMappingHooks, ResourceRetrieval, RestfulActions, RestfulRendering, RestfulSupport, RouteDrawingHooks, RouteFor, RouteSetPatches, Scope, StringPatches, Suggest, Utils Classes: Callback, RouteNode, RouteStep

Constant Summary collapse

VERSION =
'0.2.21'
PleaseFileABug =
"Ack, that shouldn't have happened. Please email the full stacktrace to <[email protected]>, so the problem you uncovered can be addressed. Thanks!"

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/hammock.rb', line 9

def self.included base # :nodoc:
  puts "Loading Hammock from #{loaded_from_gem? ? 'gem' : 'plugin'}"

  Dir.glob("#{File.dirname __FILE__}/hammock/**/*.rb").each {|dep|
    require dep
  }

  Hammock.constants.map {|constant_name|
    Hammock.const_get constant_name
  }.select {|constant|
    constant.is_a?(Module) && !constant.is_a?(Class)
  }.partition {|mod|
    mod.constants.include?('LoadFirst') && mod::LoadFirst
  }.flatten.each {|mod|
    target = mod.constants.include?('MixInto') ? mod::MixInto : base
    target.send :include, mod
  }
end

.loaded_from_gem?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/hammock.rb', line 28

def self.loaded_from_gem?
  File.dirname(__FILE__)[`gem env gemdir`.chomp]
end