Module: LatoBlog::Tag::EntityHelpers

Included in:
LatoBlog::Tag
Defined in:
app/models/lato_blog/tag/entity_helpers.rb

Instance Method Summary collapse

Instance Method Details

#get_number_of_postsObject

This function return the number of posts of the tag.



32
33
34
# File 'app/models/lato_blog/tag/entity_helpers.rb', line 32

def get_number_of_posts
  self.posts.length
end

#get_pretty_created_atObject

This function returns a pretty presentation of the creation date for the post.



12
13
14
# File 'app/models/lato_blog/tag/entity_helpers.rb', line 12

def get_pretty_created_at
  self.created_at.strftime('%d/%m/%Y - %H:%M')
end

#get_pretty_languageObject

This function return the pretty name of the language of the tag.



5
6
7
8
9
# File 'app/models/lato_blog/tag/entity_helpers.rb', line 5

def get_pretty_language
  CONFIGS[:lato_blog][:languages].values.each do |language|
    return language[:title] if language[:identifier] === self.meta_language
  end
end

#get_pretty_updated_atObject

This function returns a pretty presentation of the update date for the post.



17
18
19
# File 'app/models/lato_blog/tag/entity_helpers.rb', line 17

def get_pretty_updated_at
  self.updated_at.strftime('%d/%m/%Y - %H:%M')
end

#get_superuser_creator_nameObject

This function returns the name of the superuser creator of the post.



22
23
24
# File 'app/models/lato_blog/tag/entity_helpers.rb', line 22

def get_superuser_creator_name
  self.superuser_creator ? self.superuser_creator.get_complete_name : 'Anonymous'
end

#get_translation_for_language(language_identifier) ⇒ Object

This function the post translation for a specific language.



27
28
29
# File 'app/models/lato_blog/tag/entity_helpers.rb', line 27

def get_translation_for_language language_identifier
  self.tag_parent.tags.find_by(meta_language: language_identifier)
end