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
| inherit_from: | |
| - .rubocop_todo.yml | |
| AllCops: | |
| TargetRubyVersion: 2.3 | |
| Include: | |
| - '**/Gemfile' | |
| - '**/Rakefile' | |
| - '**/config.ru' | |
| Exclude: |
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 TicTacToe | |
| def initialize | |
| @player1 = Player.new(1, 'X') | |
| @player2 = Player.new(2, 'O') | |
| @players = [@player1, @player2] | |
| @winner = false | |
| @board = Board.new | |
| end | |
| def play |
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
| CREATE OR REPLACE FUNCTION text_to_json(text text, regex varchar) RETURNS json[] AS $$ | |
| DECLARE | |
| chunk text; | |
| res json[]; | |
| BEGIN | |
| FOREACH chunk IN array regexp_split_to_array(text, regex) | |
| LOOP | |
| IF TRIM(chunk) <> '' THEN | |
| BEGIN | |
| res := res || chunk::json; |
OlderNewer