Module: Rack::WebProfiler::Collector::DSL::ClassMethods
- Defined in:
- lib/rack/web_profiler/collector.rb
Instance Attribute Summary collapse
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
Instance Method Summary collapse
- #collect(&block) ⇒ Object
-
#icon(icon = nil) ⇒ Object
Set the icon of the Rack::WebProfiler::Collector.
-
#identifier(identifier = nil) ⇒ Object
Set the identifier of the Rack::WebProfiler::Collector.
-
#is_enabled?(is_enabled = true) ⇒ Boolean
Tell if the Rack::WebProfiler::Collector is enabled.
-
#label(label = nil) ⇒ Object
Set the label of the Rack::WebProfiler::Collector.
- #position(position = nil) ⇒ Object
-
#template(template = nil, type: :file) ⇒ Object
Set the template of the Rack::WebProfiler::Collector.
Instance Attribute Details
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
20 21 22 |
# File 'lib/rack/web_profiler/collector.rb', line 20 def definition @definition end |
Instance Method Details
#collect(&block) ⇒ Object
41 |
# File 'lib/rack/web_profiler/collector.rb', line 41 def collect(&block); definition.collect = block; end |
#icon(icon = nil) ⇒ Object
Set the icon of the Rack::WebProfiler::Collector.
25 |
# File 'lib/rack/web_profiler/collector.rb', line 25 def icon(icon = nil); definition.icon = icon; end |
#identifier(identifier = nil) ⇒ Object
Set the identifier of the Rack::WebProfiler::Collector.
30 |
# File 'lib/rack/web_profiler/collector.rb', line 30 def identifier(identifier = nil); definition.identifier = identifier; end |
#is_enabled?(is_enabled = true) ⇒ Boolean
Tell if the Rack::WebProfiler::Collector is enabled.
55 56 57 58 |
# File 'lib/rack/web_profiler/collector.rb', line 55 def is_enabled?(is_enabled = true) definition.is_enabled = Proc.new if block_given? definition.is_enabled = is_enabled end |
#label(label = nil) ⇒ Object
Set the label of the Rack::WebProfiler::Collector.
35 |
# File 'lib/rack/web_profiler/collector.rb', line 35 def label(label = nil); definition.label = label; end |
#position(position = nil) ⇒ Object
38 |
# File 'lib/rack/web_profiler/collector.rb', line 38 def position(position = nil); definition.position = position.to_i; end |
#template(template = nil, type: :file) ⇒ Object
Set the template of the Rack::WebProfiler::Collector.
47 48 49 50 |
# File 'lib/rack/web_profiler/collector.rb', line 47 def template(template = nil, type: :file) template = get_data_contents(template) if type == :DATA definition.template = template end |