<< | Index | >>
Note
Solution
Reference (Delegate, Forwardable)
Experiment
require 'delegate' class Test1 < SimpleDelegator def initialize(obj) super(obj) end def hello #p 'hello' hello2 end end class Test2 def hello2 p "byebye" end end test2 = Test2.new test1 = Test1.new(test2) test.hello
Result
"byebye"
Note
Conclusion
Experiment
def index_lookup(query) if(@session.language == 'en') lang = 'de' else lang = @session.language end @session.app.search_migel_alphabetical(query, lang) end
def search_migel_alphabetical(query, lang) MIGEL_SERVER.migelid.search_by_name(query) end
Result
Problem
Note
Solution
Note
Task
def migel_search if migel_code = @session.user_input(:migel_code) and product = @session.search_migel_products(migel_code).first ODDB::State::Migel::Items.new(@session, ODDB::Migel::Items.new(product)) elsif migel_code = @session.user_input(:migel_product) and product = @session.search_migel_products(migel_code).first ODDB::State::Migel::Product.new(@session, product) else self end end
STRINGS = [ ... :migel_product,
class Migelid < Migel::ModelSuper belongs_to :subgroup, delegates(:group) ... alias :product_text :migelid_text
Access
Result
Note
Next
def product_description(model) ... link.href = @lookandfeel._event_url(:migel_search, {:migel_product => model.migel_code.gsub(/\./, '')}) ... end
Result
Next
Problem
Note
model = if(model.respond_to? :structural_ancestors) model.structural_ancestors(@session.app) elsif(sbm = @session.state.snapback_model) [sbm] end || [] offset = compose_list(model, offset)
structural_ancestors
method
Experiment
def structural_ancestors(app) [group, subgroup] end
def pointer 'pointer' end
def pointer 'pointer' end
def pointer 'pointer' end
def pointer_descr(model, session=@session) link = PointerLink.new(:pointer_descr, model, @session, self) unless(@session.allowed?('edit', model)) link.href = if model.pointer.respond_to?(:to_csv) and smart_link_format = model.pointer.to_csv.gsub(/registration/, 'reg').gsub(/sequence/, 'seq').gsub(/package/, 'pack').split(/,/) and smart_link_format.include?('reg') @lookandfeel._event_url(:show, smart_link_format) else old_link_format = {:pointer => model.pointer} @lookandfeel._event_url(:show, old_link_format) end end link end
Key Point
Access
Result
Note
Current (z.B.)
Goal
Experiment
STRINGS = [ ... :migel_subgroup,
def migel_search if migel_code = @session.user_input(:migel_code) and product = @session.search_migel_products(migel_code).first ODDB::State::Migel::Items.new(@session, ODDB::Migel::Items.new(product)) elsif migel_code = @session.user_input(:migel_product) and product = @session.search_migel_products(migel_code).first ODDB::State::Migel::Product.new(@session, product)elsif migel_code = @session.user_input(:migel_subgroup)
code = migel_code.split(/(\d\d)/).select{|x| !x.empty?}
groupcd = code[0]
subgroupcd = code[1]
subgroup = @session.app.migel_group(groupcd).subgroup(subgroupcd)
ODDB::State::Migel::Subgroup.new(@session, subgroup)
else self end end
Access
Result
Experiment
STRINGS = [ ... :migel_group,
def migel_search if migel_code = @session.user_input(:migel_code) and product = @session.search_migel_products(migel_code).first ODDB::State::Migel::Items.new(@session, ODDB::Migel::Items.new(product)) elsif migel_code = @session.user_input(:migel_product) and product = @session.search_migel_products(migel_code).first ODDB::State::Migel::Product.new(@session, product) elsif migel_code = @session.user_input(:migel_subgroup) code = migel_code.split(/(\d\d)/).select{|x| !x.empty?} groupcd = code[0] subgroupcd = code[1] subgroup = @session.app.migel_group(groupcd).subgroup(subgroupcd) ODDB::State::Migel::Subgroup.new(@session, subgroup)elsif migel_code = @session.user_input(:migel_group) and group = @session.app.migel_group(migel_code)
ODDB::State::Migel::Group.new(@session, group)
else self end end
Access
Result
Refactoring (for Migel DRbObject)
def migel_search if migel_code = @session.user_input(:migel_code) and product = @session.search_migel_products(migel_code).first ODDB::State::Migel::Items.new(@session, ODDB::Migel::Items.new(product)) elsif migel_code = @session.user_input(:migel_product) and product = @session.search_migel_products(migel_code).first ODDB::State::Migel::Product.new(@session, product) elsif migel_code = @session.user_input(:migel_subgroup) and subgroup = @session.app.search_migel_subgroup(migel_code) ODDB::State::Migel::Subgroup.new(@session, subgroup) elsif migel_code = @session.user_input(:migel_group) and group = @session.app.search_migel_group(migel_code) ODDB::State::Migel::Group.new(@session, group) else self end end
def search_migel_subgroup(migel_code) if code = migel_code.split(/(\d\d)/).select{|x| !x.empty?} and groupcd = code[0] and subgroupcd = code[1] migel_group(groupcd).subgroup(subgroupcd) end end def search_migel_group(migel_code) migel_group(migel_code) end
Access
Result
Next