Module: Hato::Config
- Extended by:
- DSL
- Defined in:
- lib/hato/config.rb
Defined Under Namespace
Modules: DSL
Classes: Plugin, Tag
Instance Attribute Summary
Attributes included from DSL
#name
Class Method Summary
collapse
Methods included from DSL
activate!, initialize, method_missing
Class Method Details
.define(&block) ⇒ Object
50
51
52
|
# File 'lib/hato/config.rb', line 50
def self.define(&block)
instance_eval(&block)
end
|
.load(config_file) ⇒ Object
40
41
42
43
44
|
# File 'lib/hato/config.rb', line 40
def self.load(config_file)
Kernel.load(config_file)
@loaded = true
self
end
|
.loaded? ⇒ Boolean
46
47
48
|
# File 'lib/hato/config.rb', line 46
def self.loaded?
@loaded
end
|
.match(tag) ⇒ Object
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/hato/config.rb', line 62
def self.match(tag)
tags.inject([]) do |buf, t|
if t.name.kind_of?(String) && t.name == tag
buf << [t]
elsif t.name.kind_of?(Regexp) && (match = t.name.match(tag))
buf << [t, match[1..-1]]
end
buf
end
end
|
.reset ⇒ Object
73
74
75
76
77
|
# File 'lib/hato/config.rb', line 73
def self.reset
@loaded = false
@config = nil
@tags = nil
end
|
.tag(name, &block) ⇒ Object
58
59
60
|
# File 'lib/hato/config.rb', line 58
def self.tag(name, &block)
self.tags << Tag.new(name, &block)
end
|
54
55
56
|
# File 'lib/hato/config.rb', line 54
def self.tags
@tags ||= []
end
|