Sha256: 8260cf7c01f7e98991180650cf99781bb98da1fdaee172bb66fe96e65fe92cd2

Contents?: true

Size: 547 Bytes

Versions: 5

Compression:

Stored size: 547 Bytes

Contents

module Eastwood
  module Context
    class JourneyRoute < Struct.new( :route, :format )
      include RouteHelpers

      def name
        route.name
      end

      def parts
        route.parts
      end

      def path
        route.path.spec.to_s.delete '()'
      end

      def coffee_name
        style_for_javascript "#{name}_path"
      end

      def coffee_args
        parts.any? ? "#{parts.join( ', ' )}='#{format}'" : ''
      end

      def coffee_path
        path.delete( '.' ).gsub /:(\w+)/, '#{\1}'
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
eastwood-0.5.1 lib/eastwood/context/journey_route.rb
eastwood-0.5.0 lib/eastwood/context/journey_route.rb
eastwood-0.4.0 lib/eastwood/context/journey_route.rb
eastwood-0.3.8 lib/eastwood/context/journey_route.rb
eastwood-0.3.7 lib/eastwood/context/journey_route.rb