Module: Clevic::Record::ClassMethods
- Defined in:
- lib/clevic/record.rb
Instance Method Summary collapse
- #create_view_class ⇒ Object
- #default_view_class ⇒ Object
- #default_view_class_name ⇒ Object
-
#define_ui(&block) ⇒ Object
Need to defer the execution of the view definition block until related models have been defined.
Instance Method Details
#create_view_class ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/clevic/record.rb', line 18 def create_view_class # create the default view class # Don't use Class.new because even if you assign # the result to a constant, there are still anonymous classes # hanging around, which gives weird results with Clevic::View.subclasses. st,line = <<-EOF, __LINE__ class #{default_view_class_name} < Clevic::DefaultView entity_class #{name} end EOF eval st, nil, __FILE__, line # keep track of the order in which views are # defined, so that can be used as the default ordering # of the views. Clevic::View.order << eval( default_view_class_name ) end |
#default_view_class ⇒ Object
36 37 38 |
# File 'lib/clevic/record.rb', line 36 def default_view_class @default_view_class ||= eval( default_view_class_name ) end |
#default_view_class_name ⇒ Object
14 15 16 |
# File 'lib/clevic/record.rb', line 14 def default_view_class_name "::Clevic::Default#{name.gsub('::','')}View" end |
#define_ui(&block) ⇒ Object
Need to defer the execution of the view definition block until related models have been defined.
42 43 44 |
# File 'lib/clevic/record.rb', line 42 def define_ui( &block ) default_view_class.define_ui_block( &block ) end |