Class: RubyMVC::Views::View
- Inherits:
-
Object
- Object
- RubyMVC::Views::View
- Defined in:
- lib/ruby_mvc/views.rb
Direct Known Subclasses
ActiveRecordModelEditor, ActiveRecordTypeEditor, TableView, WebView
Instance Attribute Summary collapse
-
#controller ⇒ Object
Returns the value of attribute controller.
-
#widget ⇒ Object
Returns the value of attribute widget.
Class Method Summary collapse
- .create_widget(klass) ⇒ Object
-
.widget(*args, &block) ⇒ Object
This method is used to define the primary widget class through which this view may be added to other widgets.
- .widget_def(targ = nil) ⇒ Object
Instance Method Summary collapse
-
#initialize(*args) ⇒ View
constructor
A new instance of View.
- #method_missing(m, *a, &b) ⇒ Object
- #peer ⇒ Object
Constructor Details
#initialize(*args) ⇒ View
Returns a new instance of View.
67 68 69 70 71 72 |
# File 'lib/ruby_mvc/views.rb', line 67 def initialize(*args) = View.(self.class) if( = args.last).is_a? Hash self.controller = [:controller] end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *a, &b) ⇒ Object
74 75 76 |
# File 'lib/ruby_mvc/views.rb', line 74 def method_missing(m, *a, &b) .send(m, *a, &b) end |
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
66 67 68 |
# File 'lib/ruby_mvc/views.rb', line 66 def controller @controller end |
#widget ⇒ Object
Returns the value of attribute widget.
66 67 68 |
# File 'lib/ruby_mvc/views.rb', line 66 def end |
Class Method Details
.create_widget(klass) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/ruby_mvc/views.rb', line 44 def self.(klass) w = self.(klass) args = w[:args] block = w[:block] args[0].new(*args[1..-1], &block) end |
.widget(*args, &block) ⇒ Object
This method is used to define the primary widget class through which this view may be added to other widgets.
56 57 58 59 |
# File 'lib/ruby_mvc/views.rb', line 56 def (*args, &block) puts "Set widget for #{self}: #{args.inspect}" = { :args => args, :block => block } end |
.widget_def(targ = nil) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ruby_mvc/views.rb', line 30 def self.(targ = nil) if targ == nil else if (x = targ.).nil? if targ != RubyMVC::Views::View self.(targ.superclass) end else x end end end |
Instance Method Details
#peer ⇒ Object
62 63 64 |
# File 'lib/ruby_mvc/views.rb', line 62 def peer .peer end |