date_selectにclassをつけたい
プラグイン作ってその中で
module ActionView module Helpers module DateHelper #中略 def select_html(type, html_options, options) case type when "year" then html_class = %(class = "#{options[:yclass] || "date_select"}") when "month" then html_class = %(class = "#{options[:mclass] || "date_select"}") when "day" then html_class = %(class = "#{options[:dclass] || "date_select"}") end name_and_id_from_options(options, type) select_html = %(<select id="#{options[:id]}" name="#{options[:name]}" #{html_class}) select_html << %( disabled="disabled") if options[:disabled] select_html << %(>\n) select_html << %(<option value=""></option>\n) if options[:include_blank] select_html << html_options.to_s select_html << "</select>\n" end #以下略
で、一応。
sendって
class Hoge def hello(*args) %(Hello ) + args.join(' ') end end hoge = Hoge.new hoge.send :hello, "fuga", "foo"
Hello fuga foo