Class: Writefully::Tools::Stationery

Inherits:
Object
  • Object
show all
Includes:
Celluloid
Defined in:
lib/writefully/tools/stationery.rb

Direct Known Subclasses

Eraser, Pencil

Defined Under Namespace

Classes: ContentModelNotFound, SomeAssetsNotRemoved, SomeAssetsNotUploaded

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index) ⇒ Stationery

Returns a new instance of Stationery.



12
13
14
15
16
17
# File 'lib/writefully/tools/stationery.rb', line 12

def initialize(index)
  @site_id  = Site.where(slug: index[:site]).first.id
  @index    = index
  @content  = Content.new(index)
  @asset    = Asset.new(index)
end

Instance Attribute Details

#assetObject (readonly)

Returns the value of attribute asset.



6
7
8
# File 'lib/writefully/tools/stationery.rb', line 6

def asset
  @asset
end

#contentObject (readonly)

Returns the value of attribute content.



6
7
8
# File 'lib/writefully/tools/stationery.rb', line 6

def content
  @content
end

#indexObject (readonly)

Returns the value of attribute index.



6
7
8
# File 'lib/writefully/tools/stationery.rb', line 6

def index
  @index
end

#site_idObject (readonly)

Returns the value of attribute site_id.



6
7
8
# File 'lib/writefully/tools/stationery.rb', line 6

def site_id
  @site_id
end

Instance Method Details

#performObject



19
20
21
22
23
# File 'lib/writefully/tools/stationery.rb', line 19

def perform
  use
ensure
  ::ActiveRecord::Base.clear_active_connections! if defined?(::ActiveRecord)
end