Class: ActiveRecord::DatabaseViews::ViewCollection
- Inherits:
-
Object
- Object
- ActiveRecord::DatabaseViews::ViewCollection
- Includes:
- Enumerable
- Defined in:
- lib/activerecord-database-views/view_collection.rb
Constant Summary collapse
- MISSING_RELATION_REGEX =
/relation \"(.*)\" does not exist/
Instance Attribute Summary collapse
-
#views ⇒ Object
readonly
Returns the value of attribute views.
Instance Method Summary collapse
- #drop! ⇒ Object
- #each ⇒ Object
-
#initialize ⇒ ViewCollection
constructor
A new instance of ViewCollection.
- #load! ⇒ Object
Constructor Details
#initialize ⇒ ViewCollection
9 10 11 |
# File 'lib/activerecord-database-views/view_collection.rb', line 9 def initialize @views = view_paths.map { |path| View.new(path) } end |
Instance Attribute Details
#views ⇒ Object (readonly)
Returns the value of attribute views.
7 8 9 |
# File 'lib/activerecord-database-views/view_collection.rb', line 7 def views @views end |
Instance Method Details
#drop! ⇒ Object
13 14 15 |
# File 'lib/activerecord-database-views/view_collection.rb', line 13 def drop! views.each(&:drop!) end |
#each ⇒ Object
17 18 19 |
# File 'lib/activerecord-database-views/view_collection.rb', line 17 def each views.each { |view| yield view } end |
#load! ⇒ Object
21 22 23 24 25 |
# File 'lib/activerecord-database-views/view_collection.rb', line 21 def load! while views.present? load_view(views.first) end end |