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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/polyrex_calendarbase.rb +58 -19
- data.tar.gz.sig +0 -0
- metadata +19 -18
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08ee75c6a048d6c37c755f6f512a376a7751cd68
|
4
|
+
data.tar.gz: 3691e9aaf486312569c185e83ef9971e146320e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 304c380a2c1784b51010e301e7e44b9afbd8826be41567c7f95bfffbfbf78fffef9f44a20a4186b5d3391e86d23b6faabfc9c3b60dd2b338ad9737d057ce89d0
|
7
|
+
data.tar.gz: c8da6bd9e8c63ad23092783322c9c889063aafc928d1c7000436a8f910a3ac623a813988159aadf974fc2ca6a41e7cc5b171cac28eccdabec66f7068eaecb8da
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/polyrex_calendarbase.rb
CHANGED
@@ -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
|
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.
|
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-
|
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
|
42
|
+
version: '1.0'
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.
|
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
|
52
|
+
version: '1.0'
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.
|
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
|
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
|
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.
|
102
|
+
version: '0.3'
|
103
103
|
- - ">="
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version: 0.
|
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.
|
112
|
+
version: '0.3'
|
113
113
|
- - ">="
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: 0.
|
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.
|
122
|
+
version: '0.2'
|
123
123
|
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: 0.
|
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.
|
132
|
+
version: '0.2'
|
133
133
|
- - ">="
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
version: 0.
|
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.
|
163
|
+
rubygems_version: 2.4.6
|
164
164
|
signing_key:
|
165
165
|
specification_version: 4
|
166
|
-
summary:
|
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
|