Class: ActiveCopy::Base

Inherits:
Object
  • Object
show all
Includes:
Attributes, Finders, Paths, Source, ActiveModel::Model
Defined in:
lib/active_copy/base.rb

Constant Summary

Constants included from Attributes

Attributes::DEFAULT_ATTRS, Attributes::DEFAULT_PATH

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Attributes

#attributes

Methods included from Finders

#matches?

Methods included from Paths

#collection_path, #index_path, #path, #relative_path, #source_path

Methods included from Source

#present?, #raw_source, #source

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *arguments) ⇒ Object



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

def method_missing method, *arguments
  super method, *arguments unless attribute? "#{method}"
  attributes[method]
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



14
15
16
# File 'lib/active_copy/base.rb', line 14

def id
  @id
end

Instance Method Details

#tagsObject

Serialize comma-separated tags to an array.



17
18
19
# File 'lib/active_copy/base.rb', line 17

def tags
  attributes[:tags].split(',').map(&:strip)
end