Class: Blogit::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/blogit/configuration.rb

Constant Summary

REDCARPET_OPTIONS =
[:hard_wrap, :filter_html, :autolink, 
:no_intraemphasis, :fenced_code, :gh_blockcode]

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Configuration) initialize

A new instance of Configuration



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/blogit/configuration.rb', line 55

def initialize
  @include_comments            = true
  @current_blogger_method      = :current_user
  @blogger_display_name_method = :username
  @datetime_format             = :short
  @posts_per_page              = 5
  @authentication_method       = :login_required
  @author_edits_only           = false
  @ajax_comments               = true
  @include_admin_actions       = true
  @default_parser           = :markdown
  @redcarpet_options           = REDCARPET_OPTIONS
end

Instance Attribute Details

- (Object) ajax_comments

If set to true, the comments form will POST and DELETE to the comments controller using AJAX calls. Defaults to true



37
38
39
# File 'lib/blogit/configuration.rb', line 37

def ajax_comments
  @ajax_comments
end

- (Object) authentication_method

The name of the before filter we’ll call to authenticate the current user. Defaults to :login_required



27
28
29
# File 'lib/blogit/configuration.rb', line 27

def authentication_method
  @authentication_method
end

- (Object) author_edits_only

Note:

This has not been properly implemented yet

If set to true, only the user who authored the post may, edit or destroy. Defaults to false



32
33
34
# File 'lib/blogit/configuration.rb', line 32

def author_edits_only
  @author_edits_only
end

- (Object) blogger_display_name_method

what method do we call on blogger to return their display name? Defaults to :username



12
13
14
# File 'lib/blogit/configuration.rb', line 12

def blogger_display_name_method
  @blogger_display_name_method
end

- (Object) current_blogger_method

The name of the controller method we’ll call to return the current blogger.



8
9
10
# File 'lib/blogit/configuration.rb', line 8

def current_blogger_method
  @current_blogger_method
end

- (Object) datetime_format

Which DateTime::FORMATS format do we use to display blog and comment publish time Defaults to :short



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

def datetime_format
  @datetime_format
end

- (Object) default_parser

The default format for parsing the blog content. Defaults to :markdown



46
47
48
# File 'lib/blogit/configuration.rb', line 46

def default_parser
  @default_parser
end

- (Object) include_admin_actions

If set to true, the create, edit, update and destroy actions will be included. If set to false, you’ll have to set these yourself elsewhere in the app



42
43
44
# File 'lib/blogit/configuration.rb', line 42

def include_admin_actions
  @include_admin_actions
end

- (Object) include_comments

Should we include comments for blog posts?



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

def include_comments
  @include_comments
end

- (Object) posts_per_page

Number of posts to show per page



22
23
24
# File 'lib/blogit/configuration.rb', line 22

def posts_per_page
  @posts_per_page
end

- (Object) redcarpet_options

When using redcarpet as content parser, pass these options as defaults Defaults to REDCARPET_OPTIONS



50
51
52
# File 'lib/blogit/configuration.rb', line 50

def redcarpet_options
  @redcarpet_options
end

Instance Method Details

- (Object) default_parser_class



69
70
71
# File 'lib/blogit/configuration.rb', line 69

def default_parser_class
  "Blogit::Parsers::#{@default_parser.to_s.classify}Parser".constantize
end