Class: Amiba::Source::Feed

Inherits:
Object
  • Object
show all
Includes:
Amiba::Source
Defined in:
lib/amiba/source/feed.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Amiba::Source

included

Constructor Details

#initialize(fn) ⇒ Feed

Returns a new instance of Feed.



9
10
11
# File 'lib/amiba/source/feed.rb', line 9

def initialize(fn)
  self.name, self.type = File.basename(fn, ".builder").split(".")
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/amiba/source/feed.rb', line 8

def name
  @name
end

#typeObject

Returns the value of attribute type.



8
9
10
# File 'lib/amiba/source/feed.rb', line 8

def type
  @type
end

Instance Method Details

#content=(c) ⇒ Object



17
18
19
# File 'lib/amiba/source/feed.rb', line 17

def content=(c)
  @content ||= self.new? ? c : File.read(filename)
end

#filenameObject



13
14
15
# File 'lib/amiba/source/feed.rb', line 13

def filename 
  @filename ||= File.join("feeds", "#{@name}.#{@type}.builder")
end


25
26
27
# File 'lib/amiba/source/feed.rb', line 25

def link
  URI.escape "/#{name}.#{type}"
end

#output_filenameObject



21
22
23
# File 'lib/amiba/source/feed.rb', line 21

def output_filename
  File.join(Amiba::Configuration.site_dir, "public/#{name}.#{type}")
end