A way of storing lists in Ruby
names = ["Faisal", "Sara", "Jane"]
| angular.module('d3AngularApp', ['d3']) | |
| .directive('d3Bars', ['$window', '$timeout', 'd3Service', | |
| function($window, $timeout, d3Service) { | |
| return { | |
| restrict: 'A', | |
| scope: { | |
| data: '=', | |
| label: '@', | |
| onClick: '&' | |
| }, |
| get '/contacts' do | |
| @contacts = [ | |
| { | |
| first_name: "Ann", | |
| last_name: "Simon" | |
| }, | |
| { | |
| first_name: "Peter", | |
| last_name: "Gabriel" |
| gem 'activerecord' | |
| gem 'pg' |
| <!DOCTYPE html> | |
| <!-- HTML5 Hello world by kirupa - http://www.kirupa.com/html5/getting_your_feet_wet_html5_pg1.htm --> | |
| <html lang="en-us"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Hello...</title> | |
| </head> | |
| <body> | |
| <section> | |
| <h1> |
| # string are processed literally inside computers | |
| puts "Martin and Maggie are awesome co-workers!" | |
| puts "here's another string" | |
| # we can add numbers since they're the same type | |
| puts 4 + 4 | |
| # we can add to strings (concat.) together to form a third string | |
| puts 4.to_s + 8.to_s |
The reference materials used for this lecture can be found at http://api.rubyonrails.org and http://guides.rubyonrails.org.
We also have to take a quick look at rails's flash object.
The flash object allows you to set temporary messages that will
| require_relative('./car') | |
| bmw = BMW.new("M4") | |
| begin | |
| bmw.accelerate | |
| bmw.accelerate | |
| rescue => e | |
| puts e | |
| end |
| require_relative('./car_methods') | |
| class Car | |
| attr_accessor :current_speed | |
| def initialize(model, color) | |
| @model = model | |
| @color = color | |
| @current_speed = 0 |