Module: Viewmatic

Defined in:
lib/activerecord-viewmatic.rb,
lib/viewmatic/view.rb,
lib/viewmatic/model.rb,
lib/viewmatic/schema.rb,
lib/viewmatic/railtie.rb,
lib/viewmatic/version.rb,
lib/viewmatic/migration.rb,
lib/viewmatic/schema_statements.rb

Overview

Container module for all Viewmatic features.

Defined Under Namespace

Modules: Migration, Model, SchemaStatements Classes: Railtie, Schema, View

Constant Summary collapse

VERSION =

Library version

'0.3.0'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.schemasArray<Viewmatic::Schema] all schemas loaded from file(s) (readonly)

Returns Array<Viewmatic::Schema] all schemas loaded from file(s).

Returns:

  • (Array<Viewmatic::Schema] all schemas loaded from file(s))

    Array<Viewmatic::Schema] all schemas loaded from file(s)



14
15
16
# File 'lib/activerecord-viewmatic.rb', line 14

def schemas
  @schemas
end

Class Method Details

.view(name) ⇒ Viewmatic::View

Fetch the first view named “name” from all schemas. If it can’t be found an exception is raised.

Returns:



23
24
25
26
# File 'lib/activerecord-viewmatic.rb', line 23

def self.view(name)
  schema = schemas.detect { |s| s.views.has_key? name }
  schema ? schema.views[name] : raise(ArgumentError, "Could not find view named `#{name}`")
end