Module: ForestLiana::Collection::ClassMethods

Defined in:
lib/forest_liana/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#collection_nameObject

Returns the value of attribute collection_name.



5
6
7
# File 'lib/forest_liana/collection.rb', line 5

def collection_name
  @collection_name
end

#is_read_onlyObject

Returns the value of attribute is_read_only.



6
7
8
# File 'lib/forest_liana/collection.rb', line 6

def is_read_only
  @is_read_only
end

#is_searchableObject

Returns the value of attribute is_searchable.



7
8
9
# File 'lib/forest_liana/collection.rb', line 7

def is_searchable
  @is_searchable
end

Instance Method Details

#action(name, opts = {}) ⇒ Object



15
16
17
18
# File 'lib/forest_liana/collection.rb', line 15

def action(name, opts = {})
  opts[:name] = name
  model.actions << ForestLiana::Model::Action.new(opts)
end

#collection(name, opts = {}) ⇒ Object



9
10
11
12
13
# File 'lib/forest_liana/collection.rb', line 9

def collection(name, opts = {})
  self.collection_name = name.to_s
  self.is_read_only = opts[:read_only] || false
  self.is_searchable = opts[:is_searchable] || true
end

#field(name, opts) ⇒ Object



20
21
22
# File 'lib/forest_liana/collection.rb', line 20

def field(name, opts)
  model.fields << opts.merge({ field: name })
end