Sha256: b44dfd9af713539fb6b1da4039d502eea5650753e3d8aa96e58618a6e735b92e
Contents?: true
Size: 890 Bytes
Versions: 1
Compression:
Stored size: 890 Bytes
Contents
# frozen_string_literal: true class Shoes # Backwards compatibility, kind of likely to be removed def self.inherited(base_class) base_class.send :include, URL # include is private, therefore send end module URL attr_accessor :app Shoes::App.subscribe_to_dsl_methods self def self.included(base_class) base_class.extend URLDefiner end def self.urls @urls ||= {} end end module URLDefiner def url(page, method) page = convert_page_to_regex(page) url_class = self Shoes::URL.urls[page] = proc do |app, arg| new_url_instance = url_class.new new_url_instance.app = app if arg new_url_instance.send(method, arg) else new_url_instance.send method end end end private def convert_page_to_regex(page) /^#{page}$/ end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shoes-core-4.0.0.rc1 | lib/shoes/url.rb |