elibri_onix_dict 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{elibri_onix_dict}
8
- s.version = "0.0.9"
8
+ s.version = "0.0.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Marcin Urbanski"]
@@ -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 }
@@ -5,7 +5,7 @@ module Elibri
5
5
  module Version
6
6
  MAJOR = 0
7
7
  MINOR = 0
8
- PATCH = 9
8
+ PATCH = 10
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
11
11
  end
@@ -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: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 9
10
- version: 0.0.9
9
+ - 10
10
+ version: 0.0.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marcin Urbanski