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 Vehicle | |
| @wheels = 4 | |
| def initialize args | |
| @color = args[:color] | |
| end | |
| def drive | |
| @status = :driving | |
| 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 BoggleBoard | |
| # because we wanted to | |
| def initialize (board_size = 4) | |
| @board_size = board_size | |
| shake! | |
| end | |
| def shake! | |
| possible_dice = [ | |
| "AAEEGN", |
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
| def is_fibonacci?(i) | |
| require "bigdecimal" | |
| require "bigdecimal/math" | |
| include BigMath | |
| plusfour = 5 * i**2 + 4 | |
| minusfour = 5 * i**2 - 4 | |
| #second argument is number of decimels for all big num arguments | |
| plusfour = BigDecimal.new(plusfour, 5) |
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 PostsController < ApplicationController | |
| caches_page :index, :show | |
| def index | |
| #if nothing happens that should affect the cache leave it alone | |
| end | |
| def edit | |
| #in any class that has potentional to change cache |
NewerOlder