ur-product 0.4 → 0.5

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/ur/product.rb +24 -2
  2. metadata +3 -3
data/lib/ur/product.rb CHANGED
@@ -122,10 +122,10 @@ module UR
122
122
  instance_variable_set("@#{variable}", (!data.nil? && data.size > 0) ?
123
123
  data.map { |d| structure_class.new d } : [])
124
124
  end
125
-
125
+
126
126
  # Handle the relations
127
+ @related_products = {}
127
128
  if relations.size > 0
128
- @related_products = {}
129
129
  @has_relations = true
130
130
  relations.each do |name, products|
131
131
  @related_products[name] = []
@@ -139,6 +139,28 @@ module UR
139
139
  end
140
140
  end
141
141
 
142
+ def documents
143
+ return @docs unless @docs.nil?
144
+ @docs = []
145
+
146
+ [
147
+ 'textteacherguide',
148
+ 'textstudyguide',
149
+ 'textscript',
150
+ 'textworksheet',
151
+ 'texttasks',
152
+ 'texttext'
153
+ ].each do |name|
154
+ @docs << @related_products[name] if !@related_products[name].nil?
155
+ end
156
+
157
+ @docs.flatten!
158
+ end
159
+
160
+ def has_documents?
161
+ (!documents.nil? && documents.size > 0)
162
+ end
163
+
142
164
  def humanized_duration
143
165
  if matched = duration.match(/^(\d\d):(\d\d):(\d\d)/)
144
166
  (full,h,m,s) = matched.to_a
metadata CHANGED
@@ -4,8 +4,8 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 4
8
- version: "0.4"
7
+ - 5
8
+ version: "0.5"
9
9
  platform: ruby
10
10
  authors:
11
11
  - Peter Hellberg
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2010-05-06 00:00:00 +02:00
16
+ date: 2010-05-10 00:00:00 +02:00
17
17
  default_executable:
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency