Skip to content

Instantly share code, notes, and snippets.

@jodosha
Created March 18, 2014 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jodosha/9617112 to your computer and use it in GitHub Desktop.
Save jodosha/9617112 to your computer and use it in GitHub Desktop.
Ruby's include tweaks for Lotus::Controller
# Coded for:
# https://github.com/lotus/controller/pull/7
module Lotus
module Controller
module Dsl
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def action(name)
puts "Defined action: #{ name }"
end
end
end
include Dsl
end
end
class ArticlesController
include Lotus::Controller
end
Lotus::Controller.action('index')
ArticlesController.action('show') # => will raise NoMethodError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment