Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
2ceb71f9
Commit
2ceb71f9
authored
May 05, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2201 from take-cheeze/day_of_week
Implement day of week methods.
parents
f0b0a2dd
7bab3d0b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
mrbgems/mruby-time/mrblib/time.rb
mrbgems/mruby-time/mrblib/time.rb
+9
-0
mrbgems/mruby-time/test/time.rb
mrbgems/mruby-time/test/time.rb
+11
-0
No files found.
mrbgems/mruby-time/mrblib/time.rb
0 → 100644
View file @
2ceb71f9
class
Time
def
sunday?
;
wday
==
0
end
def
monday?
;
wday
==
1
end
def
tuesday?
;
wday
==
2
end
def
wednesday?
;
wday
==
3
end
def
thursday?
;
wday
==
4
end
def
friday?
;
wday
==
5
end
def
saturday?
;
wday
==
6
end
end
mrbgems/mruby-time/test/time.rb
View file @
2ceb71f9
...
@@ -197,5 +197,16 @@ if Object.const_defined?(:Time)
...
@@ -197,5 +197,16 @@ if Object.const_defined?(:Time)
assert
(
'Time#inspect'
)
do
assert
(
'Time#inspect'
)
do
Time
.
at
(
1300000000.0
).
utc
.
inspect
==
"Sun Mar 13 07:06:40 UTC 2011"
Time
.
at
(
1300000000.0
).
utc
.
inspect
==
"Sun Mar 13 07:06:40 UTC 2011"
end
end
assert
(
'day of week methods'
)
do
t
=
Time
.
gm
(
2012
,
12
,
24
)
assert_false
t
.
sunday?
assert_true
t
.
monday?
assert_false
t
.
tuesday?
assert_false
t
.
wednesday?
assert_false
t
.
thursday?
assert_false
t
.
friday?
assert_false
t
.
saturday?
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment