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 'set' | |
| require 'forwardable' | |
| # Board is a 9x9 standard sudoku board. This class does not care about what is | |
| # stored in each cell of the board, it merely provides indexing and enumeration | |
| # methods including accessing rows, columns, or 3x3 sudoku boxes. | |
| class Board | |
| extend Forwardable | |
| # @param data [Array] flat array of 81 initial cell values |
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 'active_support/inflector' | |
| # Argument parsing | |
| # My solution to http://codingdojo.org/kata/Args/ | |
| module Args | |
| # Error occured during argument parsing. {StandardError#message} should give | |
| # a description about the error. | |
| class ArgsError < StandardError; end | |
| # An argument schema. |
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 'set' | |
| require 'forwardable' | |
| # Board is a 9x9 standard sudoku board. This class does not care about what is | |
| # stored in each cell of the board, it merely provides indexing and enumeration | |
| # methods including accessing rows, columns, or 3x3 sudoku boxes. | |
| class Board | |
| extend Forwardable | |
| # @param data [Array] flat array of 81 initial cell values |
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 'forwardable' | |
| # Board is a 9x9 standard sudoku board. This class does not care about what is | |
| # stored in each cell of the board, it merely provides indexing and enumeration | |
| # methods including accessing rows, columns, or 3x3 sudoku boxes. | |
| class Board | |
| extend Forwardable | |
| # @param data [Array] flat array of 81 initial cell values | |
| def initialize(data) |
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 'active_support' | |
| require 'active_model' | |
| class Form | |
| include ActiveModel::Validations | |
| include ActiveModel::Attributes | |
| attribute :blah | |
| validates :blah, numericality: true | |
| 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 'active_support' | |
| require 'active_model' | |
| class X | |
| include ActiveModel::Validations | |
| include ActiveModel::Attributes | |
| attribute :blah | |
| validates :blah, numericality: { greater_than_or_equal_to: 0 } |
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 'rspec/autorun' | |
| class X | |
| def call | |
| fund_query | |
| end | |
| private | |
| def fund_qeuery |
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 'rspec/autorun' | |
| RSpec::Matchers.define :be_one_of do |expected| | |
| match do |actual| | |
| expected.include? actual | |
| end | |
| end | |
| RSpec.describe 13 do | |
| it 'is in the list of allowed values' do |
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 'tempfile' | |
| module Music | |
| refine Float do | |
| def hz | |
| self | |
| end | |
| def khz | |
| self * 1000 |
OlderNewer