Module: Maktoub

Defined in:
lib/maktoub.rb,
lib/maktoub/engine.rb,
lib/maktoub/version.rb,
app/helpers/maktoub/archives_helper.rb,
app/mailers/maktoub/newsletter_mailer.rb,
app/helpers/maktoub/application_helper.rb,
lib/generators/maktoub/config_generator.rb,
app/controllers/maktoub/archives_controller.rb,
app/controllers/maktoub/application_controller.rb,
app/controllers/maktoub/subscribers_controller.rb

Defined Under Namespace

Modules: ApplicationHelper, ArchivesHelper, Generators Classes: ApplicationController, ArchivesController, Engine, NewsletterMailer, SubscribersController

Constant Summary collapse

VERSION =
"0.2.5"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.app_nameObject

Returns the value of attribute app_name.



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

def app_name
  @app_name
end

.email_fieldObject



17
18
19
# File 'lib/maktoub.rb', line 17

def email_field
  @email_field || :email
end

.facebook_urlObject

Returns the value of attribute facebook_url.



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

def facebook_url
  @facebook_url
end

.fromObject

Returns the value of attribute from.



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

def from
  @from
end

.google_plus_urlObject

Returns the value of attribute google_plus_url.



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

def google_plus_url
  @google_plus_url
end

.home_domainObject

Returns the value of attribute home_domain.



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

def home_domain
  @home_domain
end

.logoObject

Returns the value of attribute logo.



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

def 
  @logo
end

.name_fieldObject



21
22
23
# File 'lib/maktoub.rb', line 21

def name_field
  @name_field || :name
end

.subscription_preferences_urlObject

Returns the value of attribute subscription_preferences_url.



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

def subscription_preferences_url
  @subscription_preferences_url
end

.twitter_urlObject

Returns the value of attribute twitter_url.



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

def twitter_url
  @twitter_url
end

.unsubscribe_methodObject

Returns the value of attribute unsubscribe_method.



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

def unsubscribe_method
  @unsubscribe_method
end

Class Method Details

.home_urlObject



41
42
43
# File 'lib/maktoub.rb', line 41

def home_url
  "http://" + home_domain
end

.subscribersObject



25
26
27
# File 'lib/maktoub.rb', line 25

def subscribers
  @subscribers.call
end

.subscribers_extractor(&block) ⇒ Object



29
30
31
# File 'lib/maktoub.rb', line 29

def subscribers_extractor (&block)
  @subscribers = Proc.new &block
end

.unsubscribe(email) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/maktoub.rb', line 33

def unsubscribe(email)
  subscribers.select do |s| 
    s.send(email_field) == email     
  end.each do |s|
    s.send(unsubscribe_method) if unsubscribe_method
  end
end