Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--color |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'rake' | ||
gem 'motion-redgreen' | ||
# Add your dependencies here: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
motion-redgreen (0.1.0) | ||
rake (10.3.2) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
motion-redgreen | ||
rake |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
class AppDelegate | ||
def application(application, didFinishLaunchingWithOptions:launchOptions) | ||
true | ||
vc = TimerController.new | ||
|
||
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) | ||
@window.rootViewController = vc | ||
@window.rootViewController.wantsFullScreenLayout = true | ||
@window.makeKeyAndVisible | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class Coach | ||
attr_accessor :rounds_count | ||
|
||
def initialize | ||
self.rounds_count = 0 | ||
end | ||
|
||
def average | ||
end | ||
|
||
def record_round | ||
self.rounds_count = self.rounds_count + 1 | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class TimerController < UIViewController | ||
def loadView | ||
self.view = TimerView.new | ||
end | ||
|
||
def viewDidLoad | ||
view.backgroundColor = UIColor.whiteColor | ||
super | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class TimerView < UIView | ||
attr_accessor :counter_label | ||
|
||
def drawRect(rect) | ||
super rect | ||
create_counter_label | ||
end | ||
|
||
def create_counter_label | ||
counter_label = UILabel.new | ||
counter_label.text = "0" | ||
counter_label.frame = self.frame | ||
counter_label.adjustsFontSizeToFitWidth = true | ||
counter_label.font = UIFont.fontWithName("Arial", size:64) | ||
|
||
|
||
self.addSubview(counter_label) | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
describe "Coach" do | ||
before do | ||
@coach = Coach.new | ||
end | ||
|
||
context "with zero rounds" do | ||
it "does not have an average" do | ||
@coach.average.should == nil | ||
end | ||
|
||
it "has zero rounds" do | ||
@coach.average.should == nil | ||
end | ||
end | ||
|
||
describe "record_round" do | ||
before do | ||
@coach.record_round | ||
end | ||
|
||
it "increments the count" do | ||
@coach.rounds_count.should == 1 | ||
end | ||
end | ||
end |