有誰知道有足夠的瞭解Ruby的require告訴我,如果下面是有效的語法: class Something
def initialize(mode)
case mode
when :one then require 'some_gem'
when :two then require 'other_gem'
end
end
end
我想知道是否可以在運行時動態注入函數參數。對於例如我有兩個重載方法的類說 Class C1
{
public static void Func1(object o)
{
}
public static void Func1()
{
}
}
Class C2
{
public void Func1()
{
def SiteAdminForm(model_cls, *args, **kwargs):
class MerchantAdminForm(forms.ModelForm):
class Meta:
exclude = ('external_links', 'published', 'logo','image_zip_file',)
model