Class: Widget
- Inherits:
-
Object
- Object
- Widget
- Defined in:
- app/models/widget.rb
Class Method Summary collapse
Instance Method Summary collapse
- #auth(&block) ⇒ Object
- #data(&block) ⇒ Object
-
#initialize(name, &block) ⇒ Widget
constructor
A new instance of Widget.
- #key(value = nil) ⇒ Object
- #key_parameter(value = nil) ⇒ Object
- #name ⇒ Object
- #public(value = nil) ⇒ Object
- #type(value = nil) ⇒ Object
Constructor Details
#initialize(name, &block) ⇒ Widget
Returns a new instance of Widget.
14 15 16 17 |
# File 'app/models/widget.rb', line 14 def initialize(name, &block) @name = name instance_eval(&block) end |
Class Method Details
.find(name) ⇒ Object
9 10 11 12 |
# File 'app/models/widget.rb', line 9 def self.find(name) Dir.glob(File.join("app", "widgets", "*.rb")).each { |f| load File.(f) } if Rails.env == "development" (@@widgets || {})[name.to_sym] end |
Instance Method Details
#auth(&block) ⇒ Object
33 34 35 36 |
# File 'app/models/widget.rb', line 33 def auth(&block) @auth = block if block_given? @auth end |
#data(&block) ⇒ Object
48 49 50 51 |
# File 'app/models/widget.rb', line 48 def data(&block) @data = block if block_given? @data end |
#key(value = nil) ⇒ Object
23 24 25 26 |
# File 'app/models/widget.rb', line 23 def key(value = nil) @key = value unless value.nil? @key end |
#key_parameter(value = nil) ⇒ Object
28 29 30 31 |
# File 'app/models/widget.rb', line 28 def key_parameter(value = nil) @key_parameter = value unless value.nil? @key_parameter || :key end |
#name ⇒ Object
19 20 21 |
# File 'app/models/widget.rb', line 19 def name @name end |
#public(value = nil) ⇒ Object
43 44 45 46 |
# File 'app/models/widget.rb', line 43 def public(value = nil) @public = value unless value.nil? @public || false end |
#type(value = nil) ⇒ Object
38 39 40 41 |
# File 'app/models/widget.rb', line 38 def type(value = nil) @type = value unless value.nil? @type end |