Module: RubyPsigate::HashVariables::InstanceMethods
- Defined in:
- lib/ruby_psigate/hash_variables.rb
Instance Method Summary collapse
Instance Method Details
#to_hash(name = nil) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ruby_psigate/hash_variables.rb', line 41 def to_hash(name=nil) return_hash = {} if name.nil? attributes = self.class.hashable_attributes[:default] else attributes = self.class.hashable_attributes[name.to_sym] end attributes.each do |a| key = "#{a}" value = self.send(a.downcase) return_hash[key.to_sym] = value end return_hash end |