days_picker 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/days_picker/helpers.rb +112 -0
  2. metadata +2 -1
@@ -0,0 +1,112 @@
1
+ module Helpers
2
+ class Sundays
3
+ class << self
4
+ Constants::BY.each do |method|
5
+ define_method(method) do |year=nil,month=nil|
6
+ eval("Dates" + "::" + "Sunday").new(year,month).send("find_sundays")
7
+ end
8
+ end
9
+
10
+ Constants::MONTHS_MAP.each_with_index do |(key,value),index|
11
+ define_method("in_#{key.to_s}") do |year=nil,month=nil|
12
+ eval("Dates" + "::" + "Sunday").new(year,month = index).send("find_sundays")
13
+ end
14
+ end
15
+ end
16
+ end
17
+
18
+ class Mondays
19
+ class << self
20
+ Constants::BY.each do |method|
21
+ define_method(method) do |year=nil,month=nil|
22
+ eval("Dates" + "::" + "Monday").new(year,month).send("find_mondays")
23
+ end
24
+ end
25
+
26
+ Constants::MONTHS_MAP.each_with_index do |(key,value),index|
27
+ define_method("in_#{key.to_s}") do |year=nil,month=nil|
28
+ eval("Dates" + "::" + "Monday").new(year,month = index).send("find_mondays")
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ class Tuesdays
35
+ class << self
36
+ Constants::BY.each do |method|
37
+ define_method(method) do |year=nil,month=nil|
38
+ eval("Dates" + "::" + "Tuesday").new(year,month).send("find_tuesdays")
39
+ end
40
+ end
41
+
42
+ Constants::MONTHS_MAP.each_with_index do |(key,value),index|
43
+ define_method("in_#{key.to_s}") do |year=nil,month=nil|
44
+ eval("Dates" + "::" + "Tuesday").new(year,month = index).send("find_tuesdays")
45
+ end
46
+ end
47
+ end
48
+ end
49
+ class Wednesdays
50
+ class << self
51
+ Constants::BY.each do |method|
52
+ define_method(method) do |year=nil,month=nil|
53
+ eval("Dates" + "::" + "Wednesday").new(year,month).send("find_wednesdays")
54
+ end
55
+ end
56
+
57
+ Constants::MONTHS_MAP.each_with_index do |(key,value),index|
58
+ define_method("in_#{key.to_s}") do |year=nil,month=nil|
59
+ eval("Dates" + "::" + "Wednesday").new(year,month = index).send("find_wednesdays")
60
+ end
61
+ end
62
+ end
63
+ end
64
+ class Thursdays
65
+ class << self
66
+ Constants::BY.each do |method|
67
+ define_method(method) do |year=nil,month=nil|
68
+ eval("Dates" + "::" + "Thursday").new(year,month).send("find_thursdays")
69
+ end
70
+ end
71
+
72
+ Constants::MONTHS_MAP.each_with_index do |(key,value),index|
73
+ define_method("in_#{key.to_s}") do |year=nil,month=nil|
74
+ eval("Dates" + "::" + "Thursday").new(year,month = index).send("find_thursdays")
75
+ end
76
+ end
77
+ end
78
+ end
79
+ class Fridays
80
+ class << self
81
+ Constants::BY.each do |method|
82
+ define_method(method) do |year=nil,month=nil|
83
+ eval("Dates" + "::" + "Friday").new(year,month).send("find_fridays")
84
+ end
85
+ end
86
+
87
+ Constants::MONTHS_MAP.each_with_index do |(key,value),index|
88
+ define_method("in_#{key.to_s}") do |year=nil,month=nil|
89
+ eval("Dates" + "::" + "Friday").new(year,month = index).send("find_fridays")
90
+ end
91
+ end
92
+ end
93
+ end
94
+
95
+ class Saturdays
96
+ class << self
97
+ Constants::BY.each do |method|
98
+ define_method(method) do |year=nil,month=nil|
99
+ eval("Dates" + "::" + "Saturday").new(year,month).send("find_saturdays")
100
+ end
101
+ end
102
+
103
+ Constants::MONTHS_MAP.each_with_index do |(key,value),index|
104
+ define_method("in_#{key.to_s}") do |year=nil,month=nil|
105
+ eval("Dates" + "::" + "Saturday").new(year,month = index).send("find_saturdays")
106
+ end
107
+ end
108
+ end
109
+ end
110
+ end
111
+
112
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: days_picker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -22,6 +22,7 @@ files:
22
22
  - lib/days_picker.rb
23
23
  - lib/days_picker/dates.rb
24
24
  - lib/days_picker/constants.rb
25
+ - lib/days_picker/helpers.rb
25
26
  - bin/days_picker
26
27
  homepage: https://github.com/ankit8898/days_picker
27
28
  licenses: []