Structured_calendar 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/structured_calendar.rb +28 -0
  3. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 738c644c85d2f3f2ea27232959b541eece0a8a30
4
+ data.tar.gz: c9ed86ee73c39d4a0f249a62b41eae774469f9b6
5
+ SHA512:
6
+ metadata.gz: c669d769ca44ec05d7724cd303819cb53515f94c0513b4b4fe2a5234c7cf031a20ffba64188f320ae45812b69b5062f319fe63ac87b77fadc978e19c53ffea80
7
+ data.tar.gz: 601075b5a94f2743fc4e57f616e0f1b88ae4ee50e03c8c17eeee106bb8d8048a4a81e74e6fc93fdc088fddb34cc30f2662e76981700f791d43e3f3ff29bb6730
@@ -0,0 +1,28 @@
1
+ #! usr/bin/ruby
2
+
3
+ require 'date'
4
+ count = 0
5
+ puts "Enter a month no[1-12](ex: 2 for february)"
6
+ mo = gets.chomp.to_i
7
+ print "Enter a year : "
8
+ yr = gets.chomp.to_i
9
+ day = 01
10
+ date = Date.new(yr,mo,day)
11
+ start_day = date.strftime('%A')
12
+ start_day = Date::DAYNAMES.index(start_day)
13
+ if mo == 2
14
+ total = Date.leap?(yr) ? 29:28
15
+ else total = Date.valid_date?(yr,mo,31) ? 31:30
16
+ end
17
+ puts " #{Date::MONTHNAMES[mo]} #{yr} "
18
+ puts ("Sun Mon Tue Wed Thu Fri Sat")
19
+ while (day <= total) do
20
+ if day == 1
21
+ print (" " * 4 *start_day)
22
+ count += 4*start_day
23
+ end
24
+ print " "+day.to_s.rjust(2, "0")+" "
25
+ count += 4
26
+ print "\n" if (count%28 == 0 or day == total)
27
+ day = day+1
28
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: Structured_calendar
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sajan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-08 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple Calendar to show a month in a structured way like we see in
14
+ desktop OS
15
+ email: sajan.sahoo@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/structured_calendar.rb
21
+ homepage: http://rubygems.org/gems/Structured_calendar
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.4.6
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: A simple calendar
45
+ test_files: []