lib/self_data.rb in self_data-1.2.1 vs lib/self_data.rb in self_data-1.3.0

- old
+ new

@@ -22,12 +22,12 @@ def converters @converters ||= {} end - def add_converter(name, block) - converters[name] = block + def add_converter(name, proc = nil, &block) + converters[name] = proc || block end end attr_reader :file @@ -48,22 +48,22 @@ end end end def read - IO.read(file).scan(/\n__END__\n(.*)/m).flatten.first or raise NoDataFound, file + File.read(file).scan(/\n__END__\n(.*)/m).flatten.first or raise NoDataFound, file end private def caller_file calls = caller.lazy .map { |call_string| call_string.split(":").first } .reject { |file| file == __FILE__ } - .select(&File.method(:exist?)) + .select { |x| File.exist?(x) } self.class.filters.each do |filter| - calls = calls.select(&filter.method(:call)) + calls = calls.select { |x| filter.call(x) } end calls.first end end