elibri_onix_dict 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/elibri_onix_dict.gemspec
CHANGED
@@ -16,6 +16,22 @@ module Elibri
|
|
16
16
|
@name[locale.to_s]
|
17
17
|
end
|
18
18
|
|
19
|
+
def method_missing(method_name, *args)
|
20
|
+
if args.empty?
|
21
|
+
if method_name.to_s =~ /\?$/
|
22
|
+
mn = method_name.to_s.gsub("?", "")
|
23
|
+
if instance_variable_defined?("@#{mn}")
|
24
|
+
value = instance_variable_get("@#{mn}")
|
25
|
+
if value.is_a?(TrueClass) || value.is_a?(FalseClass)
|
26
|
+
return value
|
27
|
+
end
|
28
|
+
end
|
29
|
+
elsif instance_variable_defined?("@#{method_name}")
|
30
|
+
return instance_variable_get("@#{method_name}")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
super
|
34
|
+
end
|
19
35
|
|
20
36
|
def self.find_by_onix_code(searched_onix_code)
|
21
37
|
self.all.find {|dict_item| dict_item.onix_code == searched_onix_code }
|
@@ -14,6 +14,16 @@ describe Elibri::ONIX::Dict::Release_3_0 do
|
|
14
14
|
assert_equal 'książka', form.name
|
15
15
|
assert_equal 'book', form.name(:en)
|
16
16
|
assert_equal 'BA', form.onix_code
|
17
|
+
assert !form.digital
|
18
|
+
assert !form.digital?
|
19
|
+
|
20
|
+
assert_raises NoMethodError do
|
21
|
+
form.physical
|
22
|
+
end
|
23
|
+
|
24
|
+
assert_raises NoMethodError do
|
25
|
+
form.physical?
|
26
|
+
end
|
17
27
|
end
|
18
28
|
|
19
29
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elibri_onix_dict
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 10
|
10
|
+
version: 0.0.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marcin Urbanski
|