Class: RubyDictionary::Klass
- Inherits:
-
Object
- Object
- RubyDictionary::Klass
- Includes:
- Findable::InstanceMethods
- Defined in:
- lib/ruby_dictionary/klass.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#definition ⇒ Object
Returns the value of attribute definition.
-
#method ⇒ Object
Returns the value of attribute method.
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #add_inst_method(method) ⇒ Object
- #add_klass_method(method) ⇒ Object
- #all_methods ⇒ Object
- #clear_method_lists ⇒ Object
-
#initialize(name = nil, definition = nil, url = nil) ⇒ Klass
constructor
A new instance of Klass.
- #inst_methods ⇒ Object
- #klass_methods ⇒ Object
- #list_all_methods ⇒ Object
- #list_inst_methods ⇒ Object
- #list_klass_methods ⇒ Object
Methods included from Findable::InstanceMethods
Constructor Details
#initialize(name = nil, definition = nil, url = nil) ⇒ Klass
Returns a new instance of Klass.
6 7 8 9 10 11 12 13 |
# File 'lib/ruby_dictionary/klass.rb', line 6 def initialize(name=nil,definition=nil,url=nil) @name = name @definition = definition @url = url @klass_methods = [] @inst_methods = [] @all_methods = [] end |
Instance Attribute Details
#definition ⇒ Object
Returns the value of attribute definition.
3 4 5 |
# File 'lib/ruby_dictionary/klass.rb', line 3 def definition @definition end |
#method ⇒ Object
Returns the value of attribute method.
3 4 5 |
# File 'lib/ruby_dictionary/klass.rb', line 3 def method @method end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/ruby_dictionary/klass.rb', line 3 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/ruby_dictionary/klass.rb', line 3 def url @url end |
Class Method Details
.all ⇒ Object
25 26 27 |
# File 'lib/ruby_dictionary/klass.rb', line 25 def self.all @@all end |
.list ⇒ Object
29 30 31 |
# File 'lib/ruby_dictionary/klass.rb', line 29 def self.list @@all.each{|k| k.name} end |
Instance Method Details
#add_inst_method(method) ⇒ Object
15 16 17 18 |
# File 'lib/ruby_dictionary/klass.rb', line 15 def add_inst_method(method) method.klass = self unless method.klass != nil @inst_methods << method unless @inst_methods.include?(method) end |
#add_klass_method(method) ⇒ Object
20 21 22 23 |
# File 'lib/ruby_dictionary/klass.rb', line 20 def add_klass_method(method) method.klass = self unless method.klass != nil @klass_methods << method unless @klass_methods.include?(method) end |
#all_methods ⇒ Object
41 42 43 |
# File 'lib/ruby_dictionary/klass.rb', line 41 def all_methods @all_methods end |
#clear_method_lists ⇒ Object
57 58 59 60 61 |
# File 'lib/ruby_dictionary/klass.rb', line 57 def clear_method_lists @inst_methods.clear @klass_methods.clear @all_methods.clear end |
#inst_methods ⇒ Object
33 34 35 |
# File 'lib/ruby_dictionary/klass.rb', line 33 def inst_methods @inst_methods end |
#klass_methods ⇒ Object
37 38 39 |
# File 'lib/ruby_dictionary/klass.rb', line 37 def klass_methods @klass_methods end |
#list_all_methods ⇒ Object
53 54 55 |
# File 'lib/ruby_dictionary/klass.rb', line 53 def list_all_methods @all_methods.each{|m| puts m.name} end |
#list_inst_methods ⇒ Object
45 46 47 |
# File 'lib/ruby_dictionary/klass.rb', line 45 def list_inst_methods @inst_methods.each{|m| puts m.name} end |
#list_klass_methods ⇒ Object
49 50 51 |
# File 'lib/ruby_dictionary/klass.rb', line 49 def list_klass_methods @klass_methods.each{|m| puts m.name} end |