Sha256: 42bf1cd73c925c392c0daa36bd149d351ec8f215a5f11c4449f40c3cbe136e9c

Contents?: true

Size: 622 Bytes

Versions: 1

Compression:

Stored size: 622 Bytes

Contents

module Navi
  module Renderers
    module SimpleNavigation
      class GeneratesUri
        easy_class_to_instance

        def initialize(template, nav_item, options={})
          @template = template
          @nav_item = nav_item
          @namespace = options[:namespace]
        end

        def execute
          url.is_a?(String) ? url : generated_path
        end

        private

        def url
          @nav_item.url
        end

        def generated_path
          args = [@namespace].flatten.compact
          args << url
          @template.polymorphic_path(args)
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
navi-0.2.0 lib/navi/renderers/simple_navigation/generates_uri.rb