method
def_children_accessor
def_children_accessor(accessor_name, plural_name)
private
Hide source
# File lib/rss/rss.rb, line 568 def def_children_accessor(accessor_name, plural_name) module_eval("def \#{plural_name}\n@\#{accessor_name}\nend\n\ndef \#{accessor_name}(*args)\nif args.empty?\n@\#{accessor_name}.first\nelse\n@\#{accessor_name}[*args]\nend\nend\n\ndef \#{accessor_name}=(*args)\nreceiver = self.class.name\nwarn(\"Warning:\\\#{caller.first.sub(/:in `.*'\\z/, '')}: \" \\\n\"Don't use `\\\#{receiver}\\#\#{accessor_name} = XXX'/\" \\\n\"`\\\#{receiver}\\#set_\#{accessor_name}(XXX)'. \" \\\n\"Those APIs are not sense of Ruby. \" \\\n\"Use `\\\#{receiver}\\#\#{plural_name} << XXX' instead of them.\")\nif args.size == 1\n@\#{accessor_name}.push(args[0])\nelse\n@\#{accessor_name}.__send__(\"[]=\", *args)\nend\nend\nalias_method(:set_\#{accessor_name}, :\#{accessor_name}=)\n", *get_file_and_line_from_caller(2)) end