oso-oso 0.8.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c85bc41901e0ed5de32a11d192da0c26b79ac44c
4
- data.tar.gz: 97f8718e22c0cee489fe7ed0db324d29fa1fb0a4
3
+ metadata.gz: 7231b9947d6b0b1b11f169d3350125de20549015
4
+ data.tar.gz: 1b56294720405d47d539b27da23f3de49f213970
5
5
  SHA512:
6
- metadata.gz: ac34d5b51b0f981965098265b2279b9b1f1b73488267e39fffe5eff3e74f484f8f46a9b03e86a6f6fd2326e23af7d93e5d139f57f807fa9e2560dd80392f6b04
7
- data.tar.gz: d89cf2110f9e7e9e6a6a8070565a59bae49770545fe918fd3ebd7f3b408743446af77a152b4fa4e524aacd999f57d6b0403986adafc04bac6c06228e27d94d39
6
+ metadata.gz: 15e4248ede8037bf1803abd40025e8e01aedce22cedc2f0a3bcae66ee0c1d013471a5a985d3a005325a9a1cbad31bdeb6378b60d5cb422a292621859b0576f71
7
+ data.tar.gz: 385e8f5b942c48bcb172afe63d44251bb258ebd67c0bad5885165de7244542e9706f306e515d92548de5a0a7dae50b4b2a72bd6a77a12cac3fab871254d59f5d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- oso-oso (0.8.0)
4
+ oso-oso (0.10.1)
5
5
  ffi (~> 1.0)
6
6
 
7
7
  GEM
@@ -14,7 +14,7 @@ GEM
14
14
  coderay (1.1.3)
15
15
  diff-lcs (1.4.4)
16
16
  e2mmap (0.1.0)
17
- ffi (1.13.1)
17
+ ffi (1.14.2)
18
18
  jaro_winkler (1.5.4)
19
19
  maruku (0.7.3)
20
20
  method_source (1.0.0)
Binary file
Binary file
Binary file
data/lib/oso.rb CHANGED
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'oso/http'
4
3
  require 'oso/oso'
5
- require 'oso/path_mapper'
6
4
  require 'oso/polar'
7
5
  require 'oso/version'
8
6
 
data/lib/oso/oso.rb CHANGED
@@ -7,8 +7,6 @@ module Oso
7
7
  class Oso < Polar::Polar
8
8
  def initialize
9
9
  super
10
- register_class(Http, name: 'Http')
11
- register_class(PathMapper, name: 'PathMapper')
12
10
  end
13
11
 
14
12
  # Query the knowledge base to determine whether an actor is allowed to
@@ -46,7 +46,7 @@ module Oso
46
46
  # @raise [DuplicateClassAliasError] if attempting to register a class
47
47
  # under a previously-registered name.
48
48
  def cache_class(cls, name:)
49
- raise DuplicateClassAliasError, name: name, old: get_class(name), new: cls if classes.key? name
49
+ raise DuplicateClassAliasError.new name: name, old: get_class(name), new: cls if classes.key? name
50
50
 
51
51
  classes[name] = cls
52
52
  name
data/lib/oso/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Oso
4
- VERSION = '0.8.0'
4
+ VERSION = '0.10.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oso-oso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oso Security, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-10 00:00:00.000000000 Z
11
+ date: 2021-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -130,9 +130,7 @@ files:
130
130
  - ext/oso-oso/lib/libpolar.so
131
131
  - ext/oso-oso/lib/polar.dll
132
132
  - lib/oso.rb
133
- - lib/oso/http.rb
134
133
  - lib/oso/oso.rb
135
- - lib/oso/path_mapper.rb
136
134
  - lib/oso/polar.rb
137
135
  - lib/oso/polar/errors.rb
138
136
  - lib/oso/polar/ffi.rb
data/lib/oso/http.rb DELETED
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Oso
4
- # An HTTP resource.
5
- class Http
6
- def initialize(hostname, path, query)
7
- @hostname = hostname
8
- @path = path
9
- @query = query
10
- end
11
-
12
- private
13
-
14
- attr_reader :hostname, :path, :query
15
- end
16
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Oso
4
- # Map from a template string with capture groups of the form
5
- # `{name}` to a dictionary of the form `{name: captured_value}`
6
- class PathMapper
7
- def initialize(template)
8
- capture_group = /({([^}]+)})/
9
-
10
- template = template.dup
11
- template.scan(capture_group).each do |outer, inner|
12
- template = if inner == '*'
13
- template.gsub! outer, '.*'
14
- else
15
- template.gsub! outer, "(?<#{inner}>[^/]+)"
16
- end
17
- end
18
- @pattern = /\A#{template}\Z/
19
- end
20
-
21
- def map(string)
22
- string.match(pattern)&.named_captures || {}
23
- end
24
-
25
- private
26
-
27
- attr_reader :pattern
28
- end
29
- end