lib/groupdocs/api/entity.rb in groupdocs-0.3.11 vs lib/groupdocs/api/entity.rb in groupdocs-1.0.0
- old
+ new
@@ -45,11 +45,11 @@
# @return [Hash]
#
def to_hash
hash = {}
instance_variables.each do |variable|
- key = variable_to_accessor(variable)
+ key = variable.to_s.delete(?@).to_sym
value = instance_variable_get(variable)
hash[key] = case value
when GroupDocs::Api::Entity
value.to_hash
@@ -117,9 +117,25 @@
word = accessor.to_s
word.capitalize!
word.gsub!(/_([a-z])/) { |match| match.upcase }
word.gsub!(/_/, '')
"@#{word}".to_sym
+ end
+
+ #
+ # Returns class name.
+ # @api private
+ #
+ def class_name
+ self.class.name.split('::').last.downcase
+ end
+
+ #
+ # Returns pluralized class name.
+ # @api private
+ #
+ def pluralized_class_name
+ "#{class_name}s"
end
end # Entity
end # Api
end # GroupDocs