Sha256: c71b1c538d8a25820f2f37aa38467db81a2f1eada19d5db8b1f457a39758ee14

Contents?: true

Size: 814 Bytes

Versions: 1

Compression:

Stored size: 814 Bytes

Contents

require "reflexive/routing_helpers"

class Method
  def reflexive_url
    level = receiver.instance_of?(Class) ? :class : :instance
    klass = receiver.instance_of?(Class) ? receiver : receiver.class
    Reflexive::Application.default_url_prefix +
      Reflexive::RoutingHelpers.new_method_path(klass, level, name)
  end
end

class UnboundMethod
  def reflexive_url
    Reflexive::Application.default_url_prefix +
      Reflexive::RoutingHelpers.new_method_path(owner, :instance, name)
  end
end

class Class
  def reflexive_url
    Reflexive::Application.default_url_prefix +
      Reflexive::RoutingHelpers.constant_path(self)
  end
end

class Module
  def reflexive_url
    Reflexive::Application.default_url_prefix +
      Reflexive::RoutingHelpers.constant_path(self)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reflexive-0.1.2 lib/reflexive/core_ext/reflexive_url.rb