class Rh::Klass

Attributes

name[R]
packages[R]
source[R]
version[R]

Public Class Methods

new(options={}) click to toggle source
# File lib/rh/klass.rb, line 9
def initialize(options={})
  @name = options['name']
  @source = options['source']
  @version = options['version']
  @packages = options['packages']
  @options = options
end

Public Instance Methods

escaped_name() click to toggle source
# File lib/rh/klass.rb, line 17
def escaped_name
  name.gsub('::', '/')
end
find_method_by_name(method_name) click to toggle source
# File lib/rh/klass.rb, line 32
def find_method_by_name(method_name)
  methods.find { |method| method.name == method_name }
end
find_methods_by_ambiguous_name(ambiguous_method_name) click to toggle source
# File lib/rh/klass.rb, line 36
def find_methods_by_ambiguous_name(ambiguous_method_name)
  if ambiguous_method_name.start_with?('#') || ambiguous_method_name.start_with?('::')
    methods.select { |method| method.name == ambiguous_method_name }
  else
    methods.select { |method| method.raw_name == ambiguous_method_name }
  end
end
methods() click to toggle source
# File lib/rh/klass.rb, line 44
def methods
  @methods ||= begin
    @options['methods'].map do |method|
      Rh::Method.new(method.merge('klass' => self, 'version' => version))
    end
  end
end
url() click to toggle source
# File lib/rh/klass.rb, line 21
def url
  case source
  when 'stdlib'
    "#{stdlib_url}/#{packages.first}/rdoc/#{escaped_name}.html"
  when 'core'
    "#{core_url}/#{escaped_name}.html"
  else
    raise 'Unable to generate URL'
  end
end