Class: Adva::Static::Import::Source::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/adva/static/import/source/base.rb

Direct Known Subclasses

Post, Section, Site

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Base

Returns a new instance of Base.



12
13
14
# File 'lib/adva/static/import/source/base.rb', line 12

def initialize(path)
  @path = normalize_path(path)
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



10
11
12
# File 'lib/adva/static/import/source/base.rb', line 10

def path
  @path
end

Instance Method Details

#<=>(other) ⇒ Object



28
29
30
# File 'lib/adva/static/import/source/base.rb', line 28

def <=>(other)
  path <=> other.path
end

#dataObject



20
21
22
# File 'lib/adva/static/import/source/base.rb', line 20

def data
  @data ||= Hashr.new(read || {})
end

#model_nameObject



24
25
26
# File 'lib/adva/static/import/source/base.rb', line 24

def model_name
  @model_name ||= self.class.name.demodulize
end

#to_hashObject



16
17
18
# File 'lib/adva/static/import/source/base.rb', line 16

def to_hash
  data
end