This file contains 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
# frozen_string_literal: true | |
# Packs/Unpacks a String to and from an Integer | |
class ShortStringPacker | |
## Packs a short string into a Integer | |
# Arguments: | |
# str - String object | |
# Returns: a Integer object | |
def self.pack(str) | |
# IMPLEMENT THIS METHOD |
This file contains 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
# frozen_string_literal: true | |
require 'csv' | |
require 'yaml' | |
# check file is tsv or not | |
def yml?(filename) | |
return raise('File not exist!') unless File.exist?(filename.to_s) # No file! | |
content = File.read(filename.to_s, encoding: 'utf-8') |
This file contains 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
# frozen_string_literal: true | |
require 'csv' | |
require 'yaml' | |
# check file is tsv or not | |
def tsv?(filename) | |
return raise('File not exist!') unless File.exist?(filename.to_s) # No file! | |
content = File.read(filename.to_s, encoding: 'utf-8') |
This file contains 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
# frozen_string_literal: true | |
## write your fizzbuzz method in this file | |
# see http://en.wikipedia.org/wiki/Fizz_buzz for details on FizzBuzz game | |
def fizzbuzz(size, &decorate) | |
arr = Array.new(size) { |i| i + 1 } | |
fizz_buzz_arr = arr.map do |item| | |
if (item % 15).zero? then 'FizzBuzz' |