Class: Howl::View

Inherits:
Hashie::Mash
  • Object
show all
Defined in:
lib/howl/view.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



9
10
11
# File 'lib/howl/view.rb', line 9

def [](key)
  super || (respond_to?(key) && send(key))
end

#format_dateObject

filters



21
22
23
24
25
26
27
# File 'lib/howl/view.rb', line 21

def format_date
  lambda do |text|
    time = Time.parse(text.to_s)
    time_format = self.date_format || "%b %-d, %Y at %-I:%M %P"
    time.strftime(time_format)
  end
end

#has_key?(key) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/howl/view.rb', line 5

def has_key?(key)
  key?(key) || respond_to?(key)
end

#postsObject



13
14
15
16
17
# File 'lib/howl/view.rb', line 13

def posts
  if site? && site.respond_to?(:posts)
    site.posts
  end
end