Sha256: dcdc8fcc30b55a95c3ef7a016beee4dcaf7239d46f465143d33134dee009f738

Contents?: true

Size: 603 Bytes

Versions: 2

Compression:

Stored size: 603 Bytes

Contents

# -*- encoding: utf-8 -*-

module Webgen

  # Mixed into modules/classes that need access to the current website object.
  module WebsiteAccess

    # The methods of this module are available on classes that include WebsiteAccess.
    module ClassMethods

      # See WebsiteAccess.website
      def website
        WebsiteAccess.website
      end

    end

    def self.included(klass) #:nodoc:
      super
      klass.extend(ClassMethods)
    end

    # Return the current website object or +nil+.
    def website
      Thread.current[:webgen_website]
    end
    module_function :website

  end

end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
gettalong-webgen-0.5.7.20090227 lib/webgen/websiteaccess.rb
webgen-0.5.7 lib/webgen/websiteaccess.rb