Skip to content

Commit

Permalink
tighter code style
Browse files Browse the repository at this point in the history
  • Loading branch information
nakajima committed Feb 2, 2009
1 parent 4646ada commit 05abd97
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lib/single_controller_inheritance.rb
Expand Up @@ -4,18 +4,13 @@ def self.included(base)
end

module ClassMethods
def expose_as(*types, &block)
options = types.extract_options!
def expose_as(*children, &block)
options = children.extract_options!
namespace = options[:namespace]

types.each do |child|
children.each do |child|
class_name = namespace.to_s + child.to_s.titleize + 'Controller'
controller = Class.new(self) do
block[child] if block_given?
end

controller = Class.new(self) { block[child] if block_given? }
logger.info "=> Generating new %s subclass: %s" % [child, class_name]

scope = namespace ? namespace.constantize : Object
scope.const_set(class_name, controller)
end
Expand Down

0 comments on commit 05abd97

Please sign in to comment.