Module: Trestle::Configurable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Configuration
- Defined in:
- lib/trestle/configurable.rb
Defined Under Namespace
Modules: ClassMethods, Open
Instance Method Summary
collapse
Instance Method Details
#as_json(options = nil) ⇒ Object
20
21
22
23
24
|
# File 'lib/trestle/configurable.rb', line 20
def as_json(options=nil)
@options.each_with_object({}) do |(k, v), h|
h[k] = v.as_json(options)
end
end
|
11
12
13
14
|
# File 'lib/trestle/configurable.rb', line 11
def configure(&block)
yield self if block_given?
self
end
|
#initialize ⇒ Object
5
6
7
8
9
|
# File 'lib/trestle/configurable.rb', line 5
def initialize
self.class.defaults.each do |name, default|
options[name] = default
end
end
|
#inspect ⇒ Object
26
27
28
|
# File 'lib/trestle/configurable.rb', line 26
def inspect
"#<#{self.class.name || "Anonymous(Trestle::Configurable)"}>"
end
|
#options ⇒ Object
16
17
18
|
# File 'lib/trestle/configurable.rb', line 16
def options
@options ||= {}
end
|