Class: Rayo::Config
- Inherits:
-
Object
- Object
- Rayo::Config
- Defined in:
- lib/rayo/config.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#cache_dir ⇒ Object
Returns the value of attribute cache_dir.
-
#content_dir ⇒ Object
Returns the value of attribute content_dir.
-
#default_domain ⇒ Object
Returns the value of attribute default_domain.
-
#default_format ⇒ Object
Returns the value of attribute default_format.
-
#languages ⇒ Object
Returns the value of attribute languages.
-
#page_exts ⇒ Object
Returns the value of attribute page_exts.
Instance Method Summary collapse
-
#add_domain(name, exp = nil) ⇒ Object
Add domain.
-
#add_filter(from, to = nil, &filter) ⇒ Object
Add filter.
-
#add_tags(tag_module) ⇒ Object
Add tags defined in module.
-
#create_tagger ⇒ Object
Create new object containing all defined tags.
- #directory(content_type) ⇒ Object
- #domain(host) ⇒ Object
- #format(name = nil) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rayo/config.rb', line 17 def initialize @languages = ['en'] @page_exts = ['.yml'] @formats = {} @domains = [] @tagger = Object.new @tagger.extend Rayo::Taggable # Default tags Rayo::Tags::PropertyTags Rayo::Tags::ContentTags Rayo::Tags::NavigationTags # Default format @default_format = 'html' end |
Instance Attribute Details
#cache_dir ⇒ Object
Returns the value of attribute cache_dir.
9 10 11 |
# File 'lib/rayo/config.rb', line 9 def cache_dir @cache_dir end |
#content_dir ⇒ Object
Returns the value of attribute content_dir.
8 9 10 |
# File 'lib/rayo/config.rb', line 8 def content_dir @content_dir end |
#default_domain ⇒ Object
Returns the value of attribute default_domain.
15 16 17 |
# File 'lib/rayo/config.rb', line 15 def default_domain @default_domain end |
#default_format ⇒ Object
Returns the value of attribute default_format.
14 15 16 |
# File 'lib/rayo/config.rb', line 14 def default_format @default_format end |
#languages ⇒ Object
Returns the value of attribute languages.
11 12 13 |
# File 'lib/rayo/config.rb', line 11 def languages @languages end |
#page_exts ⇒ Object
Returns the value of attribute page_exts.
12 13 14 |
# File 'lib/rayo/config.rb', line 12 def page_exts @page_exts end |
Instance Method Details
#add_domain(name, exp = nil) ⇒ Object
Add domain
47 48 49 |
# File 'lib/rayo/config.rb', line 47 def add_domain( name, exp = nil ) @domains << Rayo::Config::Domain.new( self, name, exp ) end |
#add_filter(from, to = nil, &filter) ⇒ Object
Add filter
65 66 67 |
# File 'lib/rayo/config.rb', line 65 def add_filter( from, to = nil, &filter ) format( to ).add_filter( from, &filter ) end |
#add_tags(tag_module) ⇒ Object
Add tags defined in module
39 40 41 |
# File 'lib/rayo/config.rb', line 39 def ( tag_module ) @tagger.extend tag_module end |
#create_tagger ⇒ Object
Create new object containing all defined tags
52 53 54 |
# File 'lib/rayo/config.rb', line 52 def create_tagger @tagger.clone end |
#directory(content_type) ⇒ Object
56 57 58 |
# File 'lib/rayo/config.rb', line 56 def directory( content_type ) File.join( @content_dir, content_type.to_s ) end |
#domain(host) ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/rayo/config.rb', line 75 def domain( host ) if @domains.empty? self # No multidomain support else @domains.find { |domain| domain.matches? host } || @domains.find { |domain| domain.name == @default_domain } end end |