Rubyの基礎が多少分かったので、次はRailsの基礎について学んでいきます。
以前書いた通り、既にRailsのインストールは終わっています。
とりあえず、Railsのアプリを動かしてみます。

次のコマンドを実行します。
amebaというアプリケーションを作成
> rails ameba

testというコントローラーを作成
> ruby script\generate controller test

indexというアクションを作成
ameba\apps\controllers\test_controller.rbを開いて
class TestController < ApplicationController
 def index
 end
end
のように記述

サーバーを起動
> ruby script\server

次のURLにアクセス
http://localhost:3000/test/index



require 'yaml'

data = YAML.load(File.new('data.yml'))
data.each do |cd|
puts "#{cd['title']} #{cd['artist']} #{cd['price']}円"
end

# data.ymlから抽出したものを連想配列でそれぞれ出力