Class: Scribo::SiteDrop

Inherits:
ApplicationDrop show all
Defined in:
app/drops/scribo/site_drop.rb

Overview

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ SiteDrop

Returns a new instance of SiteDrop.



10
11
12
13
# File 'app/drops/scribo/site_drop.rb', line 10

def initialize(object)
  @object = object
  @properties = object.properties
end

Instance Method Details

#categoriesObject

TODO



54
55
56
# File 'app/drops/scribo/site_drop.rb', line 54

def categories
  []
end

#current_localeObject



67
68
69
# File 'app/drops/scribo/site_drop.rb', line 67

def current_locale
  I18n.locale.to_s
end

#dataObject



44
45
46
# File 'app/drops/scribo/site_drop.rb', line 44

def data
  Scribo::DataDrop.new(@object)
end

#documentsObject

TODO



49
50
51
# File 'app/drops/scribo/site_drop.rb', line 49

def documents
  []
end

#html_filesObject



40
41
42
# File 'app/drops/scribo/site_drop.rb', line 40

def html_files
  @object.contents.html_files.to_a
end

#html_pagesObject



36
37
38
# File 'app/drops/scribo/site_drop.rb', line 36

def html_pages
  @object.contents.html_pages.to_a
end

#liquid_method_missing(method) ⇒ Object



75
76
77
78
79
80
81
# File 'app/drops/scribo/site_drop.rb', line 75

def liquid_method_missing(method)
  if collections.include?(method)
    @object.contents.in_folder("_#{method}").order(:created_at).to_a
  else
    @properties[method.to_s]
  end
end

#localeObject



71
72
73
# File 'app/drops/scribo/site_drop.rb', line 71

def locale
  @properties['locale']
end

#pagesObject



19
20
21
# File 'app/drops/scribo/site_drop.rb', line 19

def pages
  @object.contents.pages.to_a
end

#postsObject



23
24
25
# File 'app/drops/scribo/site_drop.rb', line 23

def posts
  @object.contents.posts.sort_by { |p| - p.date.to_i }.to_a
end

TODO



28
29
30
# File 'app/drops/scribo/site_drop.rb', line 28

def related_posts
  []
end

#static_filesObject



32
33
34
# File 'app/drops/scribo/site_drop.rb', line 32

def static_files
  @object.contents.assets.to_a
end

#tagsObject

TODO



59
60
61
# File 'app/drops/scribo/site_drop.rb', line 59

def tags
  []
end

#timeObject



15
16
17
# File 'app/drops/scribo/site_drop.rb', line 15

def time
  Time.current
end

#urlObject



63
64
65
# File 'app/drops/scribo/site_drop.rb', line 63

def url
  @properties['url']
end