Module: Orange

Defined in:
lib/orange-core/core.rb,
lib/orange-core/stack.rb,
lib/orange-core/carton.rb,
lib/orange-core/magick.rb,
lib/orange-core/packet.rb,
lib/orange-core/resource.rb,
lib/orange-core/application.rb,
lib/orange-core/resources/mapper.rb,
lib/orange-core/resources/parser.rb,
lib/orange-core/resources/scaffold.rb,
lib/orange-core/middleware/rerouter.rb,
lib/orange-core/resources/not_found.rb,
lib/orange-core/resources/page_parts.rb,
lib/orange-core/middleware/four_oh_four.rb,
lib/orange-core/resources/model_resource.rb,
lib/orange-core/resources/routable_resource.rb

Defined Under Namespace

Modules: Inflector, Middleware, Mixins, Plugins, Pulp Classes: Application, Carton, Core, DefaultHash, Ignore, Mapper, ModelResource, NotFound, NotFoundException, Options, Packet, PageParts, Parser, Reroute, Resource, RoutableResource, Scaffold, Stack

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#pluginsObject

Returns the value of attribute plugins.



14
15
16
# File 'lib/orange-core/core.rb', line 14

def plugins
  @plugins
end

Class Method Details

.add_pulp(inc) ⇒ Object

Allow pulp directly from Orange



39
40
41
# File 'lib/orange-core/core.rb', line 39

def self.add_pulp(inc)
  Packet.mixin inc
end

.autoload!Object

Automatically load and require resources, cartons, and middleware



44
45
46
47
48
49
# File 'lib/orange-core/core.rb', line 44

def self.autoload!
  Dir.glob(File.join('cartons', '*.rb')).each { |f|  require f }
  Dir.glob(File.join('resources', '*.rb')).each { |f| require f }
  Dir.glob(File.join('middleware', '*.rb')).each { |f|  require f }
  @required = true
end

.autoloaded?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/orange-core/core.rb', line 51

def self.autoloaded?
  @required || false
end

.mixin(inc) ⇒ Object

Allow mixins directly from Orange



34
35
36
# File 'lib/orange-core/core.rb', line 34

def self.mixin(inc)
  Core.mixin inc
end

.plugin(plugin) ⇒ Object

Allows adding plugins



29
30
31
# File 'lib/orange-core/core.rb', line 29

def self.plugin(plugin)
  self.plugins << plugin if plugin.kind_of?(Orange::Plugins::Base)
end

.plugins(plugin_list = false) ⇒ Object

Support for plugins



17
18
19
20
21
22
23
24
25
26
# File 'lib/orange-core/core.rb', line 17

def self.plugins(plugin_list = false)
  @plugins ||= []
  return @plugins unless plugin_list
  @plugins.select do |p| 
    plugin_list.include?(
      Extlib::Inflection::underscore(
        Extlib::Inflection::demodulize(p.class.to_s)
      ).to_sym)
  end
end