ldap-relations 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,16 @@
1
+ module Ldap
2
+ module Relations
3
+ class And
4
+ def initialize left, right
5
+ @left = left
6
+ @right = right
7
+ end
8
+
9
+ attr_accessor :left, :right
10
+
11
+ def to_filter
12
+ "(&#{left.to_filter}#{right.to_filter})"
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ module Ldap
2
+ module Relations
3
+ class Or
4
+ def initialize left, right
5
+ @left = left
6
+ @right = right
7
+ end
8
+
9
+ attr_accessor :left, :right
10
+
11
+ def to_filter
12
+ "(|#{left.to_filter}#{right.to_filter})"
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,5 +1,5 @@
1
1
  module Ldap
2
2
  module Relations
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+ require 'ldap-relations/and'
3
+
4
+ module Ldap::Relations
5
+ describe And do
6
+ let(:left) { stub 'Relation', to_filter: '(user=test)' }
7
+ let(:right) { stub 'Relation', to_filter: '(mail=test)' }
8
+ let(:and_group) { And.new left, right }
9
+
10
+ describe '#to_filter' do
11
+ subject { and_group.to_filter }
12
+
13
+ it { should == '(&(user=test)(mail=test))' }
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+ require 'ldap-relations/or'
3
+
4
+ module Ldap::Relations
5
+ describe Or do
6
+ let(:left) { stub 'Relation', to_filter: '(name=test)' }
7
+ let(:right) { stub 'Relation', to_filter: '(mail=test)' }
8
+ let(:or_group) { Or.new left, right }
9
+
10
+ describe '#to_filter' do
11
+ subject { or_group.to_filter }
12
+
13
+ it { should == "(|(name=test)(mail=test))" }
14
+ end
15
+ end
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ldap-relations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -58,11 +58,15 @@ files:
58
58
  - Rakefile
59
59
  - ldap-relations.gemspec
60
60
  - lib/ldap-relations.rb
61
+ - lib/ldap-relations/and.rb
62
+ - lib/ldap-relations/or.rb
61
63
  - lib/ldap-relations/relation.rb
62
64
  - lib/ldap-relations/relation_manager.rb
63
65
  - lib/ldap-relations/version.rb
64
66
  - spec/.rspec
67
+ - spec/ldap-relations/and_spec.rb
65
68
  - spec/ldap-relations/integration_spec.rb
69
+ - spec/ldap-relations/or_spec.rb
66
70
  - spec/ldap-relations/relation_manager_spec.rb
67
71
  - spec/ldap-relations/relation_spec.rb
68
72
  - spec/spec_helper.rb
@@ -92,7 +96,9 @@ specification_version: 3
92
96
  summary: Abstraction of filters to use with an LDAP library.
93
97
  test_files:
94
98
  - spec/.rspec
99
+ - spec/ldap-relations/and_spec.rb
95
100
  - spec/ldap-relations/integration_spec.rb
101
+ - spec/ldap-relations/or_spec.rb
96
102
  - spec/ldap-relations/relation_manager_spec.rb
97
103
  - spec/ldap-relations/relation_spec.rb
98
104
  - spec/spec_helper.rb