Sha256: 1a49eeab61ad6cf59fba99d5e1482064bd1a01d4a3166e60a665cdaf597f8ab7

Contents?: true

Size: 1.33 KB

Versions: 15

Compression:

Stored size: 1.33 KB

Contents

require 'merb_global/providers'

module Merb
  module Global
    module DateProviders
      include Providers
      # call-seq:
      #     provider => provider
      #
      # Returns the provider of required type
      #
      # ==== Returns
      # provider<Provider>:: Returns provider
      def self.provider
        @@provider ||= self[Merb::Global.config(:date_provider, 'fork')]
      end
      # Merb-global is able to handle localization in different ways.
      # Providers are the interface.
      #
      # Please note that it is not required to include this module - despite it
      # is recomended both as a documentation part and the more customized
      # error messages.
      module Base
        ##
        # 
        # Localize date using format as in strftime
        def localize(lang, date, format)
          raise NoMethodError.new('method localize has not been implemented')
        end
      end
    end
    # Perform the registration
    #
    # ==== Parameters
    # name<~to_sym>:: Name under which it is registered
    def self.DateProvider(provider_name)
      Module.new do
        @@rb_date_provider_name = provider_name
        include Merb::Global::DateProviders::Base
        
        def self.included(klass)
          Merb::Global::DateProviders.register @@rb_date_provider_name, klass
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
lastobelus-merb_global-0.0.10 lib/merb_global/date_providers.rb
lastobelus-merb_global-0.0.11 lib/merb_global/date_providers.rb
lastobelus-merb_global-0.0.12 lib/merb_global/date_providers.rb
lastobelus-merb_global-0.0.13 lib/merb_global/date_providers.rb
lastobelus-merb_global-0.0.14 lib/merb_global/date_providers.rb
lastobelus-merb_global-0.0.8 lib/merb_global/date_providers.rb
lastobelus-merb_global-0.0.9 lib/merb_global/date_providers.rb
emipair-merb_global-0.0.12 lib/merb_global/date_providers.rb
emipair-merb_global-0.0.11 lib/merb_global/date_providers.rb
emipair-merb_global-0.0.10 lib/merb_global/date_providers.rb
emipair-merb_global-0.0.9 lib/merb_global/date_providers.rb
emipair-merb_global-0.0.3 lib/merb_global/date_providers.rb
emipair-merb_global-0.0.2 lib/merb_global/date_providers.rb
emipair-merb_global-0.0.1 lib/merb_global/date_providers.rb
merb_global-0.0.7 lib/merb_global/date_providers.rb