Module: Hashify
- Included in:
- Worklog::DailyLog, Worklog::LogEntry
- Defined in:
- lib/hash.rb
Instance Method Summary collapse
-
#to_hash ⇒ Hash
Convert the object’s instance variables to a hash.
Instance Method Details
#to_hash ⇒ Hash
Convert the object’s instance variables to a hash.
6 7 8 9 10 11 |
# File 'lib/hash.rb', line 6 def to_hash instance_variables.each_with_object({}) do |var, hash| key = var.to_s.delete('@').to_sym hash[key] = instance_variable_get(var) end end |