anytime 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/anytime.rb +3 -3
- data/lib/app/controllers/anytime_controller.rb +13 -0
- metadata +2 -2
- data/app/controllers/anytime_controller.rb +0 -11
data/lib/anytime.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'mocha'
|
2
|
+
require 'app/controllers/anytime_controller'
|
3
|
+
|
4
|
+
module Anytime
|
2
5
|
|
3
|
-
class Anytime
|
4
6
|
def self.freeze_at(year, month, date, hour=0, min=0, sec=0)
|
5
|
-
p "-------------#{year}, #{month}, #{date}"
|
6
7
|
DateTime.stubs(:now).returns(DateTime.new(year, month, date, hour, min, sec, self.utc_offset))
|
7
8
|
Time.stubs(:now).returns(Time.send(self.time_mode, year, month, date, hour, min, sec))
|
8
9
|
Date.stubs(:today).returns(Date.new(year, month, date))
|
9
|
-
p "=============#{Time.now}"
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.unfreeze!
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'action_controller/base'
|
2
|
+
|
3
|
+
class AnytimeController < ActionController::Base
|
4
|
+
def freeze
|
5
|
+
date = params[:date]
|
6
|
+
Anytime.freeze_at(date[:year].to_i, date[:month].to_i, date[:day].to_i, date[:hour].to_i, date[:minute].to_i, date[:second].to_i)
|
7
|
+
redirect_to :back
|
8
|
+
end
|
9
|
+
|
10
|
+
def unfreeze
|
11
|
+
Anytime.unfreeze!
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anytime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -35,7 +35,7 @@ extensions: []
|
|
35
35
|
extra_rdoc_files: []
|
36
36
|
files:
|
37
37
|
- lib/anytime.rb
|
38
|
-
- app/controllers/anytime_controller.rb
|
38
|
+
- lib/app/controllers/anytime_controller.rb
|
39
39
|
- config/routes.rb
|
40
40
|
homepage: http://rubygems.org/gems/anytime
|
41
41
|
licenses: []
|
@@ -1,11 +0,0 @@
|
|
1
|
-
class AnytimeController < ApplicationController
|
2
|
-
|
3
|
-
def freeze
|
4
|
-
Anytime.freeze_at(params[:year].to_i, params[:month].to_i, params[:day].to_i, params[:hour].to_i, params[:minute].to_i, params[:second].to_i)
|
5
|
-
redirect_to :back
|
6
|
-
end
|
7
|
-
|
8
|
-
def unfreeze
|
9
|
-
Anytime.unfreeze!
|
10
|
-
end
|
11
|
-
end
|