holiday_tools 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,12 +1,36 @@
1
1
  # HolidayTools
2
2
 
3
- TODO: Write a gem description
3
+ This is a wrapper around the alexdunae/holidays gem with a more intuitive API (at least IMO). It uses the region-id's of that gem to filter the results.
4
+
5
+ ## API Description
6
+
7
+ ### Class methods
8
+
9
+ * **show_regions**
10
+ generates a list of region-id's and names of that region (country in Englich and sub-region in local name, e.g. Germany/Sachsen)
11
+
12
+ ### Instance methods
13
+
14
+ * **new(filter=[])**
15
+ You may supply an array of region-id's (see show_regions)
16
+
17
+ * **show\_holiday( date )**
18
+ Generates a list of all public holidays for _date_, which is a Date object (e.g. Date.today)
19
+
20
+ * **show\_week( date )**
21
+ Generates the list of holidays for the week (sunday to saturday), which contains the date
22
+
23
+ * **show\_month( date )**
24
+ Generates the list of holidays for the month, which contains the date
25
+
26
+ * **show\_year( date )**
27
+ Generates the list of holidays for the year, which contains the date
4
28
 
5
29
  ## Installation
6
30
 
7
31
  Add this line to your application's Gemfile:
8
32
 
9
- gem 'holiday_tools'
33
+ $ gem 'holiday_tools'
10
34
 
11
35
  And then execute:
12
36
 
@@ -18,8 +42,20 @@ Or install it yourself as:
18
42
 
19
43
  ## Usage
20
44
 
21
- TODO: Write usage instructions here
45
+ Included in the gem is an executable, which can be used as CLI command. Examples:
46
+
47
+ $ holiday_tools
48
+ shows all regions which observe today a public holiday
49
+
50
+ $ holiday_tools --date 2013-05-01 --mode m
51
+ shows all holidays in all regions in May, 2013
52
+
53
+ $ holiday_tools --mode y at ge
54
+ shows all holidays in the current year in Austria and Germany
22
55
 
56
+ $ holiday_tools --help
57
+ shows the usage hints
58
+
23
59
  ## Contributing
24
60
 
25
61
  1. Fork it
data/bin/holiday_tools CHANGED
@@ -92,6 +92,7 @@ rescue OptionParser::InvalidOption
92
92
  end
93
93
 
94
94
  if @opts.list
95
+ puts "Region \tName"
95
96
  puts HolidayTools::Locator.show_regions
96
97
  exit
97
98
  end
@@ -156,7 +156,6 @@ module HolidayTools
156
156
  def self.show_regions
157
157
  regs = Holidays.regions.sort
158
158
  txt = []
159
- txt << "Region \tName"
160
159
  regs.each do |key|
161
160
  name = @@reg_names[key]
162
161
  if name
@@ -1,3 +1,3 @@
1
1
  module HolidayTools
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -23,7 +23,7 @@ describe HolidayTools do
23
23
  it 'should list all available regions' do
24
24
  regions = HolidayTools::Locator.show_regions
25
25
  p regions
26
- regions.size.should == 101
26
+ regions.size.should == 100
27
27
 
28
28
  end
29
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: holiday_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-06 00:00:00.000000000 Z
12
+ date: 2013-06-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: holidays