Sha256: 325a740384f4f5d911b41293c0e9925fe1331d48b576c0b0c091717972540572
Contents?: true
Size: 1014 Bytes
Versions: 1
Compression:
Stored size: 1014 Bytes
Contents
require 'cgi' require 'rh/has_url' module Rh class Method include HasUrl attr_reader :klass, :name, :raw_name, :source, :package, :type, :version def initialize(options={}) @klass = options['klass'] @source = options['source'] @package = options['package'] @version = options['version'] @name = options['name'] match = name.match(/(#|::)(.+)/) raise "Invalid method name: #{name} in #{klass.name}" unless match @type = match[1] == '#' ? :instance : :class @raw_name = match[2] end def escaped_name CGI.escape(raw_name).gsub('%', '-') end def url type_string = type == :class ? 'c' : 'i' case source when 'core' "#{core_url}/#{klass.escaped_name}.html#method-#{type_string}-#{escaped_name}" when 'stdlib' "#{stdlib_url}/#{package}/rdoc/#{klass.escaped_name}.html#method-#{type_string}-#{escaped_name}" else raise 'Unable to generate URL' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rh-0.0.3 | lib/rh/method.rb |