ruby操作文件
require 'app/configuration'
module RubyAMF
module Configuration
#set the service path used in all requests
# RubyAMF::App::RequestStore.service_path = File.expand_path(RAILS_ROOT) + '/app/controllers'
# => CLASS MAPPING CONFIGURATION
ClassMappings.register(
:actionscript => 'Stock',
:ruby => 'Stock',
:type => 'active_record',
:attributes => ["code", "name"])
end
end
ClassMappings.register(
:actionscript => 'Rolestock',
:ruby => 'Rolestock',
:type => 'active_record',
:associations => ["stock"],
:attributes => ["id", "cost", "amount"])
上面算是整个文件吧,之后我在另一个同等级路径文件下要操作这个文件
File.open("rubyamf_config.rb") do |file|
while line = file.gets
相关问答:
下面是输出一个小于100的Fibnancci数列:
class test1
def Fib(max)
i1,i2 = 1,1
while i1 <= max
yield i1
......
我在ruby on rails上执行系统命令,但是该系统命令都在我默认的路径上执行的,即/var/www/my。现在我用ruby语言编程,可创建了一个新目录aaa(system "mkdir aaa"即可),但是我不能进入aaa目录下进行操作 ......
require 'app/configuration'
module RubyAMF
module Configuration
#set the service path used in all requests
# RubyAMF::App::RequestStore.service_p ......
请问有没有人学习Ruby语言?
这个问题有什么意义?
肯定有
。。。。。。。。。。。。。。呵呵
这个可以有
啪啪地,
。。。有还是没有?
引用
这个问题有什么意义?
散分的意义的有!
哈哈, ......
1. 例如在
Person.rb 中
Python code:
class Person
def talk
puts "nihao"
end
end
Student.rb
Python code:
class Student < Person
def talk
puts &quo ......