Sha256: ca8402bd788a70ce022db9f058e610b08adfa5022fe0d4f30844d96090adb080

Contents?: true

Size: 629 Bytes

Versions: 4

Compression:

Stored size: 629 Bytes

Contents

module FormattedURL
  module Strategies
    # Default strategy to manage
    # paths. Returns the +path+ by
    # default
    class DefaultURLStrategy

      # The URL path
      attr_reader :path

      # Formats +path+ for a given +format+
      def self.url(path, format)
        new(path).send(format)
      end

      # Receives URL +path+
      def initialize(path)
        @path = path
      end

      # Returns +path+ by default
      def default
        path
      end
      
      # Returns default path when
      # receive unknown message
      def method_missing(*args)
        default
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
formatted_url-0.0.6 lib/formatted_url/strategies/default_url_strategy.rb
formatted_url-0.0.5 lib/formatted_url/strategies/default_url_strategy.rb
formatted_url-0.0.4 lib/formatted_url/strategies/default_url_strategy.rb
formatted_url-0.0.3 lib/formatted_url/strategies/default_url_strategy.rb