Class: Mongoo::DescribeDsl
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
#attribute
#embeds_many, #embeds_one
#define_grid_fs_file_method, #define_grid_fs_files_method, #grid_fs_file, #grid_fs_files
Constructor Details
Returns a new instance of DescribeDsl.
11
12
13
|
# File 'lib/mongoo/describe_dsl.rb', line 11
def initialize(klass)
@klass = klass
end
|
Class Method Details
.after_describe ⇒ Object
3
4
5
|
# File 'lib/mongoo/describe_dsl.rb', line 3
def self.after_describe
@after_describe ||= []
end
|
.before_describe ⇒ Object
7
8
9
|
# File 'lib/mongoo/describe_dsl.rb', line 7
def self.before_describe
@before_describe ||= []
end
|
Instance Method Details
#describe(&block) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/mongoo/describe_dsl.rb', line 15
def describe(&block)
Mutex.new.synchronize do
self.class.before_describe.uniq!
self.class.after_describe.uniq!
self.class.before_describe.each do |m|
send(m)
end
block.call(self)
self.class.after_describe.each do |m|
send(m)
end
end
end
|
#index(*args) ⇒ Object
32
33
34
|
# File 'lib/mongoo/describe_dsl.rb', line 32
def index(*args)
@klass.send(:index, *args)
end
|