Class: ActiveFolder::Base

Inherits:
OpenStruct
  • Object
show all
Extended by:
Model::Traits::Collection
Includes:
Model::Traits::Persistence, Model::Traits::Relation
Defined in:
lib/activefolder/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Model::Traits::Collection

build, create, create!, destroy_all, find_or_create, find_or_initialize

Methods included from Model::Traits::Enumeration

#all, #count, #find, #find!, #first, #last, #to_a, #where

Class Method Details

.model_base_dirObject



21
# File 'lib/activefolder/base.rb', line 21

def model_base_dir; '/' end

.model_classObject



20
# File 'lib/activefolder/base.rb', line 20

def model_class; self; end

.model_nameObject



15
16
17
18
# File 'lib/activefolder/base.rb', line 15

def model_name
  model = name.demodulize
  model.underscore.pluralize
end

Instance Method Details

#attributesObject



29
30
31
# File 'lib/activefolder/base.rb', line 29

def attributes
  self.to_h.except(:name, :base_dir)
end

#pathObject



24
25
26
27
# File 'lib/activefolder/base.rb', line 24

def path
  required(:name); required(:base_dir)
  File.join(base_dir, name)
end