Sha256: 813a2c3f2bf874b39eec01d11efb0d6f7cac35cc40cfe4adcbf75577472983b0

Contents?: true

Size: 508 Bytes

Versions: 3

Compression:

Stored size: 508 Bytes

Contents

module Eastwood
  module Context
    class ClientRoute < Struct.new( :key, :route, :suffix )
      include RouteHelpers

      def name
        key.to_s
      end

      def parts
        route.scan( /:(\w+)/ ).flatten.map &:to_sym
      end

      def path
        route
      end

      def coffee_name
        style_for_javascript "#{name}_#{suffix}"
      end

      def coffee_args
        parts.join ', '
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
eastwood-0.5.1 lib/eastwood/context/client_route.rb
eastwood-0.5.0 lib/eastwood/context/client_route.rb
eastwood-0.4.0 lib/eastwood/context/client_route.rb