This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # todo | |
| # class restaurant | |
| class FastFood | |
| attr_reader :name | |
| def initialize(name, city, prep_time) | |
| @name = name | |
| @city = city | |
| @prep_time = prep_time | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Restaurant | |
| attr_reader :name | |
| def initialize(name, city) | |
| @name, @city = name, city | |
| end | |
| def to_s | |
| return "Welcome to #{@name}, in #{@city}" | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Restaurant | |
| attr_reader :name | |
| def initialize(name, city) | |
| @name, @city = name, city | |
| end | |
| def self.categories | |
| return %w(fast-food gastronomic traditional) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Chief | |
| attr_reader :name, :restaurant | |
| def initialize(name, age, restaurant) | |
| @name = name | |
| @age = age | |
| @restaurant = restaurant | |
| end | |
| end | |
| class Restaurant |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Here is the game! | |
| require 'gosu' | |
| require_relative 'player' | |
| require_relative 'star' | |
| module ZOrder | |
| Background, Stars, Player, UI = *0..3 | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'gosu' | |
| class Player | |
| attr_reader :score | |
| def initialize | |
| @image = Gosu::Image.new("images/xwing.png") | |
| @x = @y = @vel_x = @vel_y = @angle = 0.0 | |
| @score = 0 | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'gosu' | |
| class Star | |
| attr_reader :x, :y | |
| def initialize(animation) | |
| @animation = animation | |
| @color = Gosu::Color.new(0xff_000000) | |
| @color.red = rand(256 - 40) + 40 | |
| @color.green = rand(256 - 40) + 40 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Call scopes directly from your URL params: | |
| # | |
| # @products = Product.filter(params.slice(:status, :location, :starts_with)) | |
| module Filterable | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| # Call the class methods with the same name as the keys in <tt>filtering_params</tt> | |
| # with their associated values. Most useful for calling named scopes from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "date" | |
| DPT = { | |
| "76" => "Seine-Maritime", | |
| "75" => "Paris" | |
| } | |
| REG_SSN = /^(?<gender>1|2)(?<year>\d{2})(?<month>0[1-9]|1[0-2])(?<zip>\d{2})\d{6}(?<key>\d{2})/ | |
| def ssn_info(ssn) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Restaurant | |
| #getter | |
| attr_reader :name | |
| # accessor | |
| attr_accessor :city | |
| def initialize(name, city) | |
| @name = name | |
| @city = city |