1.属性的读写控制
class Man
def initialize(name,sex)
@name = name
@age = 16
@sex = sex
end
# 只读
def get_name
return @name
end
# 只写
def set_age(age)
@age = age
end
# 读写
def get_sex
return @sex
en ...……
#以|为分割点,将arr转换为二维数组
arr =
tmp =
tmp2 =
for x in arr
tmp amp;amp;lt;amp;amp;lt; x if x != '|'
tmp2.push Array.new(tmp) if x == amp;quot;|amp;quot;
tmp.cle……
最近配置production环境,找了好几份文档,从傻逼到苦逼~~终于配置成功~~@_@!!!
首先,先加载以下几个插件:
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', 'amp;amp;gt;= 1.3.0'
# Use Co ...……
article = nil
article.nil? # =amp;amp;gt; true
empty? checks if an element - like a string or an array f.e. - is empty:
# Array
.empty? #=amp;amp;gt; true
# String
amp;quot;amp;quot;.empty? #=am ...……