Module: VulgataMethods

Extended by:
ActiveSupport::Concern
Defined in:
lib/vulgata/concerns/vulgata_methods.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#vulgata_after_approvedObject



40
41
42
# File 'lib/vulgata/concerns/vulgata_methods.rb', line 40

def vulgata_after_approved
  self.vlg_after_approved.blank? ? nil : self.send(self.vlg_after_approved)
end

#vulgata_context_pathObject

name of path helper for the object’s context - i.e :blog_post_path (for a Comment object)



83
84
85
# File 'lib/vulgata/concerns/vulgata_methods.rb', line 83

def vulgata_context_path
  vlg_context_path
end

#vulgata_context_path_paramObject

name of param to send to path helper - property of associated object - i.e :post (for a Comment object)



88
89
90
# File 'lib/vulgata/concerns/vulgata_methods.rb', line 88

def vulgata_context_path_param
  vlg_context_path_param
end

#vulgata_item_typeObject



66
67
68
# File 'lib/vulgata/concerns/vulgata_methods.rb', line 66

def vulgata_item_type
  self.class.base_class.name
end

#vulgata_nameObject



70
71
72
# File 'lib/vulgata/concerns/vulgata_methods.rb', line 70

def vulgata_name
  self[:name] || self[:title]|| self[:subject] || self[:description] || self[:body] || self[:text] || self.to_s
end

#vulgata_preprocess_getter(data) ⇒ Object



48
49
50
# File 'lib/vulgata/concerns/vulgata_methods.rb', line 48

def vulgata_preprocess_getter data
  self.vlg_preprocess_getter.blank? ? data : self.send(self.vlg_preprocess_getter, data)
end

#vulgata_preprocess_setter(data) ⇒ Object



44
45
46
# File 'lib/vulgata/concerns/vulgata_methods.rb', line 44

def vulgata_preprocess_setter data
  self.vlg_preprocess_setter.blank? ? data.delete_if { |k, v| v.blank? } : self.send(self.vlg_preprocess_setter, data)
end

#vulgata_priorityObject



74
75
76
# File 'lib/vulgata/concerns/vulgata_methods.rb', line 74

def vulgata_priority
  @vlg_priority || vlg_priority
end

#vulgata_priority=(value) ⇒ Object



78
79
80
# File 'lib/vulgata/concerns/vulgata_methods.rb', line 78

def vulgata_priority= value
  @vlg_priority = value
end

#vulgata_save_translation(translation_state) ⇒ Object



62
63
64
# File 'lib/vulgata/concerns/vulgata_methods.rb', line 62

def vulgata_save_translation translation_state
  self.vlg_strategy.save_translation translation_state
end

#vulgata_translated_attribute_namesObject

returns array of the translated attributes names



53
54
55
# File 'lib/vulgata/concerns/vulgata_methods.rb', line 53

def vulgata_translated_attribute_names
  self.class.vulgata_translated_attribute_names
end

#vulgata_translation_data(translation_state) ⇒ Object

returns hash of the translated data



58
59
60
# File 'lib/vulgata/concerns/vulgata_methods.rb', line 58

def vulgata_translation_data translation_state
  self.vlg_strategy.translation_data translation_state
end