mongoid_oslc 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/mongoid/oslc.rb CHANGED
@@ -3,14 +3,6 @@ require 'mongoid/oslc/version'
3
3
  require 'mongoid/oslc/strategy'
4
4
  require 'active_support/concern'
5
5
 
6
- # OSLC
7
- OSLC_FIELDS_MAPPING ||= {
8
- "dcterms:title" => "title",
9
- "dcterms:description" => "description",
10
- "dcterms:created" => "created_at",
11
- "oslc_cm:closed" => "closed"
12
- }
13
-
14
6
  module Mongoid
15
7
  module Oslc
16
8
  extend ActiveSupport::Concern
@@ -72,11 +72,26 @@ module Mongoid
72
72
 
73
73
  class Condition < GrammarNode
74
74
  def to_mongo_query
75
- field = OSLC_FIELDS_MAPPING[elements[0].text_value]
75
+ field = fields[elements[0].text_value]
76
76
  value = elements[2].to_mongo_query
77
77
  operator_with_value = elements[1].to_mongo_query_with_value(value)
78
78
  { field => operator_with_value }
79
79
  end
80
+
81
+ private
82
+
83
+ def fields
84
+ @fields = if defined?(OSLC_FIELDS_MAPPING)
85
+ OSLC_FIELDS_MAPPING
86
+ else
87
+ {
88
+ "dcterms:title" => "title",
89
+ "dcterms:description" => "description",
90
+ "dcterms:created" => "created_at",
91
+ "oslc_cm:closed" => "closed"
92
+ }
93
+ end
94
+ end
80
95
  end
81
96
  end
82
97
  end
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Oslc
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_oslc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -133,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  segments:
135
135
  - 0
136
- hash: 4115431999775652418
136
+ hash: -1265591135292783318
137
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  segments:
144
144
  - 0
145
- hash: 4115431999775652418
145
+ hash: -1265591135292783318
146
146
  requirements: []
147
147
  rubyforge_project:
148
148
  rubygems_version: 1.8.24