Module: CrossOrigin
- Defined in:
- lib/cross_origin.rb,
lib/cross_origin/version.rb,
lib/cross_origin/criteria.rb,
lib/cross_origin/document.rb,
lib/cross_origin/collection.rb
Defined Under Namespace
Modules: Document
Classes: Collection, Config, Criteria
Constant Summary
collapse
- VERSION =
'0.0.2'
Class Method Summary
collapse
Class Method Details
.[](origin) ⇒ Object
18
19
20
|
# File 'lib/cross_origin.rb', line 18
def [](origin)
origin_options[to_name(origin)]
end
|
.config(origin, options = {}) ⇒ Object
22
23
24
25
26
|
# File 'lib/cross_origin.rb', line 22
def config(origin, options = {})
origin = to_name(origin)
fail "Not allowed for origin name: #{origin}" if origin == :default
origin_options[origin] || (origin_options[origin] = Config.new(origin, options))
end
|
.configurations ⇒ Object
28
29
30
|
# File 'lib/cross_origin.rb', line 28
def configurations
origin_options.values
end
|
.names ⇒ Object
32
33
34
|
# File 'lib/cross_origin.rb', line 32
def names
origin_options.keys
end
|
.to_name(origin) ⇒ Object
10
11
12
13
14
15
16
|
# File 'lib/cross_origin.rb', line 10
def to_name(origin)
if origin.is_a?(Symbol)
origin
else
origin.to_s.to_sym
end
end
|