Module: ReeDto::EntityDSL::InstanceMethods
- Defined in:
- lib/ree_lib/packages/ree_dto/package/ree_dto/entity_dsl.rb
Instance Method Summary collapse
Instance Method Details
#inspect ⇒ Object
36 37 38 |
# File 'lib/ree_lib/packages/ree_dto/package/ree_dto/entity_dsl.rb', line 36 def inspect to_s end |
#to_s ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ree_lib/packages/ree_dto/package/ree_dto/entity_dsl.rb', line 15 def to_s variables = self .instance_variables .map(&:to_s) .map { |v| v.gsub('@', '') } .sort max_length = variables.sort_by(&:size).last.size result = "\n#{self.class}\n" result << variables .map { |variable| name = variable.to_s extra_spaces = ' ' * (max_length - name.size) %Q( #{name}#{extra_spaces} = #{instance_variable_get("@#{variable}")}) } .join("\n") result end |