pretty_ruby:Ruby的语法改进和其他有用的方法

时间:2021-03-02 18:47:51
【文件属性】:
文件名称:pretty_ruby:Ruby的语法改进和其他有用的方法
文件大小:10KB
文件格式:ZIP
更新时间:2021-03-02 18:47:51
Ruby 它有什么作用? 在现有方法中添加有用的方法和新语法,以提高可读性和表达性。 示例将最好地说明: require 'pretty_ruby' using PrettyRuby # map methods that require arguments arr = [ [ 'a' , 'b' , 'c' ] , [ 'd' , 'e' , 'f' ] ] arr . map ( :join , '-' ) #=> [ 'a-b-c', 'd-e-f' ] # use >> as a pipeline operator arr = 'hello' . chars arr . map ( :next >> :upcase ) . join ( '-' ) #=> "I-F-M-M-P" # support negative take and drop arr = [ 1 , 2 , 3 , 4
【文件预览】:
pretty_ruby-master
----pretty_ruby-0.0.1.gem(6KB)
----test()
--------pretty_ruby_test.rb(9KB)
----LICENSE(1KB)
----pretty_ruby.gemspec(329B)
----lib()
--------pretty_ruby.rb(5KB)
----README.md(2KB)

网友评论