From: "Carina C. Zona" Date: 2011-10-19T15:57:25+09:00 Subject: Re: Custom Method not running A method is called upon its receiver object. Your method is defined such that sort is being called upon implicit receiver 'self' (in this context, self == Object) and passed an argument of either 'less' or 'more'. The Object object doesn't have a method called 'sort', thus the error message. To sort object 'less' or 'more', you need to call sort on those objects: less.sort + [middle] + more.sort On Tue, Oct 18, 2011 at 11:44 PM, Junayeed Ahnaf Nirjhor wrote: > Hello, > > > > Why this code is not running, anyone ? > > > > def dictionary_sort arr > > return arr if arr.length <=1 > > middle = arr.pop > > less = arr.select{|x| x.downcase < middle.downcase} > > more = arr.select{|x| x.downcase >= middle.downcase} > > sort(less) + [middle] + sort(more) > > end > > words = ['can','feel','singing.','like','A','can'] > > puts(dictionary_sort(words).join(' ')) > > > > Error is following: > > > > C:/Users/Nirjhor/RubymineProjects/dictionary sort.rb:20:in `dictionary_sort': undefined method `sort' for main:Object (NoMethodError) > >                from C:/Users/Nirjhor/RubymineProjects/dictionary sort.rb:23:in `' > >                from -e:1:in `load' > >                from -e:1:in `
' > > > > Peace be upon you – > > Junayeed Ahnaf Nirjhor > > Twitter - @Nirjhor > > > > --   Carina