polyrex_calendarbase 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a76ddecbad0afa3c2bb679841ef101c4d91d71b9
4
- data.tar.gz: 7d6a9b0c0279d698512dfe129def188b17ac39dc
3
+ metadata.gz: 08ee75c6a048d6c37c755f6f512a376a7751cd68
4
+ data.tar.gz: 3691e9aaf486312569c185e83ef9971e146320e9
5
5
  SHA512:
6
- metadata.gz: ed295bbb7dc17f2c76f2813284e57f35f22b0c40d620de4879f4b94f989bfd5350fc18239fee09f23cb5320d3b8d8d0b9406dd6df87a6e0393eb2da5af43f1a3
7
- data.tar.gz: 15d7f8e8a9424fb8629ab2d51d257061a77ef25f6707f1d91e58deaa843259fad4d4b46c746fb59b1db40100a2c1fb75fcc8e92322948bcbf67c547bd16fb815
6
+ metadata.gz: 304c380a2c1784b51010e301e7e44b9afbd8826be41567c7f95bfffbfbf78fffef9f44a20a4186b5d3391e86d23b6faabfc9c3b60dd2b338ad9737d057ce89d0
7
+ data.tar.gz: c8da6bd9e8c63ad23092783322c9c889063aafc928d1c7000436a8f910a3ac623a813988159aadf974fc2ca6a41e7cc5b171cac28eccdabec66f7068eaecb8da
checksums.yaml.gz.sig CHANGED
Binary file
@@ -10,28 +10,14 @@ require 'chronic_cron'
10
10
  require 'rxfhelper'
11
11
 
12
12
 
13
- h = {
14
- calendar: 'calendar[year]',
15
- month: 'month[n, title]',
16
- week: 'week[n, mon, no, label]',
17
- day: 'day[sdate, xday, event, bankholiday, title, sunrise, sunset]',
18
- entry: 'entry[time_start, time_end, duration, title]'
19
- }
20
- visual_schema = h.values.join '/'
21
-
22
- class CalendarObjects < PolyrexObjects
23
- end
24
-
25
- CalendarObjects.new(visual_schema)
26
-
27
13
  module LIBRARY
28
14
 
29
15
  def fetch_file(filename)
30
16
 
31
17
  lib = File.dirname(__FILE__)
32
- File.read File.join(lib,filename)
18
+ File.read File.join(lib,'..','stylesheet',filename)
33
19
 
34
- end
20
+ end
35
21
 
36
22
  def generate_webpage(xml, xsl)
37
23
 
@@ -46,6 +32,42 @@ module LIBRARY
46
32
  end
47
33
  end
48
34
 
35
+ h = {
36
+ calendar: 'calendar[year]',
37
+ month: 'month[n, title]',
38
+ week: 'week[n, mon, no, label]',
39
+ day: 'day[sdate, xday, event, bankholiday, title, sunrise, sunset]',
40
+ entry: 'entry[time_start, time_end, duration, title]'
41
+ }
42
+
43
+ visual_schema = h.values.join '/'
44
+
45
+ class CalendarObjects < PolyrexObjects
46
+ end
47
+
48
+ CalendarObjects.new(visual_schema)
49
+
50
+ class CalendarObjects::Month < PolyrexObjects::Month
51
+
52
+ def initialize(filename)
53
+
54
+ @filename = filename
55
+
56
+ buffer = File.read filename
57
+ @doc = Rexle.new buffer
58
+ @node = @doc.root
59
+
60
+ end
61
+
62
+ def save(filename=@filename)
63
+ File.write filename, @doc.xml(pretty: true)
64
+ end
65
+ end
66
+
67
+
68
+
69
+
70
+
49
71
  class Calendar < Polyrex
50
72
  include LIBRARY
51
73
 
@@ -91,7 +113,22 @@ class PolyrexObjects
91
113
  def d(n)
92
114
  self.records[n-1]
93
115
  end
94
-
116
+
117
+ def find_today()
118
+ self.element "//day/summary[xday='#{Time.now.day}']"
119
+ end
120
+
121
+ def highlight_today()
122
+
123
+ # remove the old highlight if any
124
+ prev_day = self.at_css '.today'
125
+ prev_day.attributes.delete :class if prev_day
126
+
127
+ today = find_today()
128
+ today.attributes[:class] = 'today'
129
+
130
+ end
131
+
95
132
  end
96
133
 
97
134
  class Week
@@ -132,6 +169,7 @@ class PolyrexCalendarBase
132
169
 
133
170
  def initialize(calendar_file=nil, options={})
134
171
 
172
+ @calendar_file = calendar_file
135
173
  opts = {year: Time.now.year.to_s}.merge(options)
136
174
  @year = opts[:year]
137
175
 
@@ -220,7 +258,8 @@ class PolyrexCalendarBase
220
258
  #polyrex
221
259
  end
222
260
 
223
- def save(filename='calendar.xml')
261
+ def save(filename=@calendar_file)
262
+ @calendar_file = 'calendar.xml' unless filename
224
263
  @calendar.save filename, pretty: true
225
264
  end
226
265
 
@@ -425,4 +464,4 @@ class PolyrexCalendarBase
425
464
  a = b.+([nil] * max_slots).take(max_slots).reverse
426
465
  end
427
466
 
428
- end
467
+ end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyrex_calendarbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  eGxjKaL2sbouS4fyw4A39SBdlnl+EEAc05wbVgSI3V3Qx6T/opctD22MCO7rCLKx
32
32
  cODimpf9WykDmA==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-01-18 00:00:00.000000000 Z
34
+ date: 2015-05-25 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: polyrex
@@ -39,20 +39,20 @@ dependencies:
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '0.9'
42
+ version: '1.0'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 0.9.3
45
+ version: 1.0.6
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
49
49
  requirements:
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: '0.9'
52
+ version: '1.0'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 0.9.3
55
+ version: 1.0.6
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: nokogiri
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -62,7 +62,7 @@ dependencies:
62
62
  version: '1.6'
63
63
  - - ">="
64
64
  - !ruby/object:Gem::Version
65
- version: 1.6.2.1
65
+ version: 1.6.6.2
66
66
  type: :runtime
67
67
  prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
@@ -72,7 +72,7 @@ dependencies:
72
72
  version: '1.6'
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 1.6.2.1
75
+ version: 1.6.6.2
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: chronic_duration
78
78
  requirement: !ruby/object:Gem::Requirement
@@ -99,40 +99,40 @@ dependencies:
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: '0.2'
102
+ version: '0.3'
103
103
  - - ">="
104
104
  - !ruby/object:Gem::Version
105
- version: 0.2.33
105
+ version: 0.3.1
106
106
  type: :runtime
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
110
  - - "~>"
111
111
  - !ruby/object:Gem::Version
112
- version: '0.2'
112
+ version: '0.3'
113
113
  - - ">="
114
114
  - !ruby/object:Gem::Version
115
- version: 0.2.33
115
+ version: 0.3.1
116
116
  - !ruby/object:Gem::Dependency
117
117
  name: rxfhelper
118
118
  requirement: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
- version: '0.1'
122
+ version: '0.2'
123
123
  - - ">="
124
124
  - !ruby/object:Gem::Version
125
- version: 0.1.12
125
+ version: 0.2.3
126
126
  type: :runtime
127
127
  prerelease: false
128
128
  version_requirements: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: '0.1'
132
+ version: '0.2'
133
133
  - - ">="
134
134
  - !ruby/object:Gem::Version
135
- version: 0.1.12
135
+ version: 0.2.3
136
136
  description:
137
137
  email: james@r0bertson.co.uk
138
138
  executables: []
@@ -160,8 +160,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  version: '0'
161
161
  requirements: []
162
162
  rubyforge_project:
163
- rubygems_version: 2.4.5
163
+ rubygems_version: 2.4.6
164
164
  signing_key:
165
165
  specification_version: 4
166
- summary: Provides building blocks to create a calendar from a Polyrex document object
166
+ summary: A calendar object which can be output to XML format from a Polyrex document
167
+ object
167
168
  test_files: []
metadata.gz.sig CHANGED
Binary file