Sha256: c7bc1b62b7e5752e289e65f203b73581822c1f07ec2170e684ab420c3abee05f

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

class RubyDictionary::Klass
  include Findable::InstanceMethods
  attr_accessor :name, :definition, :url, :method
  @@all = []

  def initialize(name=nil,definition=nil,url=nil)
    @name = name
    @definition = definition
    @url = url
    @klass_methods = []
    @inst_methods = []
    @all_methods = []
  end

  def add_inst_method(method)
    method.klass = self unless method.klass != nil
    @inst_methods << method unless @inst_methods.include?(method)
  end

  def add_klass_method(method)
    method.klass = self unless method.klass != nil
    @klass_methods << method unless @klass_methods.include?(method)
  end

  def self.all
    @@all
  end

  def self.list
    @@all.each{|k| k.name}
  end

  def inst_methods
    @inst_methods
  end

  def klass_methods
    @klass_methods
  end

  def all_methods
    @all_methods
  end

  def list_inst_methods
    @inst_methods.each{|m| puts m.name}
  end

  def list_klass_methods
    @klass_methods.each{|m| puts m.name}
  end

  def list_all_methods
    @all_methods.each{|m| puts m.name}
  end

  def clear_method_lists
    @inst_methods.clear
    @klass_methods.clear
    @all_methods.clear
  end


end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby_dictionary-1.0.0 lib/ruby_dictionary/klass.rb