class ActiveScaffold::DataStructures::ProxyColumn
Constants
- COPY_VARS
Attributes
Public Class Methods
Source
# File lib/active_scaffold/data_structures/proxy_column.rb, line 24 def self.attr_accessor(*names) attr_reader(*names) attr_writer(*names) end
Source
# File lib/active_scaffold/data_structures/proxy_column.rb, line 16 def self.attr_reader(*names) names.each do |name| define_method name do instance_variable_defined?(:"@#{name}") ? instance_variable_get(:"@#{name}") : @column.send(name) end end end
Source
# File lib/active_scaffold/data_structures/proxy_column.rb, line 6 def initialize(column) @column = column # without override_or_delegate, the methods won't use column's values if they are set # with override_or_delegate, if they had no value, they won't return overrided form_ui # the easier way is copying variables to proxy object (column.instance_variables & COPY_VARS).each do |var| instance_variable_set(var, column.instance_variable_get(var)) end end
Source
# File lib/active_scaffold/data_structures/proxy_column.rb, line 29 def self.override_or_delegate(*names) location = caller_locations(1, 1).first method_def = names.map do |name| "def #{name}(...) instance_variable_defined?(\"@#{name.to_s.gsub(/\?$/, '')}\") ? super : @column.send(\"#{name}\", ...) end" end module_eval method_def.join(';'), location.path, location.lineno names end
Public Instance Methods
Source
# File lib/active_scaffold/data_structures/proxy_column.rb, line 64 def is_a?(klass) super || @column.is_a?(klass) end
Calls superclass method
Source
# File lib/active_scaffold/data_structures/proxy_column.rb, line 43 def method_missing(name, ...) if respond_to_missing?(name, true) @column.send(name, ...) else super end end
Calls superclass method
Source
# File lib/active_scaffold/data_structures/proxy_column.rb, line 55 def params=(value) @params = Set.new(*value) end
Source
# File lib/active_scaffold/data_structures/proxy_column.rb, line 51 def respond_to_missing?(name, include_all = false) (!name.match?(/[!=]$/) && @column.respond_to?(name, include_all)) || super end
Calls superclass method