Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Created by https://www.gitignore.io/api/ruby,rubymine+all

### Ruby ###
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/

# Used by dotenv library to load environment variables.
# .env

## Specific to RubyMotion:
.dat*
.repl_history
build/
*.bridgesupport
build-iPhoneOS/
build-iPhoneSimulator/

## Specific to RubyMotion (use of CocoaPods):
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# vendor/Pods/

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/

## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

### RubyMine+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Ruby plugin and RubyMine
/.rakeTasks

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### RubyMine+all Patch ###
# Ignores the whole idea folder
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360

.idea/

# End of https://www.gitignore.io/api/ruby,rubymine+all
11 changes: 0 additions & 11 deletions lib/transport.rb

This file was deleted.

5 changes: 5 additions & 0 deletions lib/transpose.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def transpose(source)
array = source.split("\n").map {|s| s.split(" ")}
transported_array = array.transpose
transported_array.map {|s| s.join(" ")}.join("\n")
end
12 changes: 7 additions & 5 deletions test/transport_test.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
require 'minitest/autorun'
require './lib/transport'
require './lib/transpose'

class TransportTest < MiniTest::Test
def test_transport
class TransposeTest < MiniTest::Test
def test_transpose_3x3
input = "1 2 3\n4 5 6\n7 8 9"
output = "1 4 7\n2 5 8\n3 6 9"
assert_equal output, transport(input)
assert_equal output, transpose(input)
end

def test_transpose_4x4
input = "1 2 3\n4 5 6\n7 8 9\n10 11 12"
output = "1 4 7 10\n2 5 8 11\n3 6 9 12"
assert_equal output, transport(input)
assert_equal output, transpose(input)
end
end