lib/ginny/models/func.rb in ginny-0.5.0 vs lib/ginny/models/func.rb in ginny-0.5.2
- old
+ new
@@ -43,10 +43,12 @@
f.modules = args[:modules] unless args[:modules].nil?
f.params = Ginny::Param.from_array(args[:params]) if args[:params]&.is_a?(Array)
return f
end
+ # Return generated code as a string.
+ #
# @return [String]
def render()
# return self.render_compact() if self.body.nil? && self.params.length == 0
parts = []
parts << self.render_description()
@@ -54,10 +56,10 @@
parts << self.render_return_type()
parts << "def " + self.name + self.render_params()
parts << self.body.indent(2) unless self.body.nil?
parts << "end"
- body = parts.compact.join("\n").gsub(/\s+$/, "")
+ body = parts.compact.join("\n").gsub(/(\s+)$/, "")
return Ginny.mod(body, self.modules) if self.modules.length > 0
return body
end