Class: FoundationKit::BaseClass
- Inherits:
-
Object
- Object
- FoundationKit::BaseClass
- Defined in:
- lib/foundation_kit/base_class.rb
Overview
BaseCass provides a core set of functionality for all
classes that extend from it.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(**args) ⇒ BaseClass
constructor
The initialize method - DUH.
-
#to_h ⇒ Hash
Returns a Hash representation of the current object.
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(**args) ⇒ BaseClass
The initialize method - DUH
13 14 15 |
# File 'lib/foundation_kit/base_class.rb', line 13 def initialize(**args) after_initialize(args) end |
Instance Method Details
#to_h ⇒ Hash
Returns a Hash representation of the current object
21 22 23 24 25 26 27 |
# File 'lib/foundation_kit/base_class.rb', line 21 def to_h temp = {} instance_variables.each do |var| temp[var.to_s.delete('@').to_sym] = hide_instance_variables(var) end temp end |
#to_s ⇒ Object Also known as: inspect
29 30 31 32 33 34 35 36 |
# File 'lib/foundation_kit/base_class.rb', line 29 def to_s to_s_string = "#{self.class}: " instance_variables.each do |var| to_s_string += "#{var}: #{hide_instance_variables(var)}, " end to_s_string += "object_id: 0x00#{(object_id << 1).to_s(16)}" to_s_string end |