aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-10-25 13:10:57 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2008-10-25 16:49:04 +0100
commit93024d49f7243ecdb319e639cefa7c2ef83d7b3b (patch)
tree98ffbe23fdf301d3206253a23a97996662aa3d5e
parent1d7e4488ea6563fb52f6775c8178c860bf361941 (diff)
downloadpaludis-93024d49f7243ecdb319e639cefa7c2ef83d7b3b.tar.gz
paludis-93024d49f7243ecdb319e639cefa7c2ef83d7b3b.tar.xz
(ruby) Add ChoiceValue#enabled_by_default?
-rw-r--r--ruby/choice.cc11
-rw-r--r--ruby/choice_TEST.rb6
2 files changed, 17 insertions, 0 deletions
diff --git a/ruby/choice.cc b/ruby/choice.cc
index 434d4cc..08404cf 100644
--- a/ruby/choice.cc
+++ b/ruby/choice.cc
@@ -285,6 +285,15 @@ namespace
/*
* call-seq:
+ * enabled_by_default? -> true or false
+ *
+ * Would this flag be enabled by default (i.e. before considering
+ * any overrides from the Environment)?
+ */
+ FAKE_RDOC_METHOD(choice_value_enabled_by_default);
+
+ /*
+ * call-seq:
* locked? -> true or false
*
* Is this flag locked (forced or masked)?
@@ -370,6 +379,8 @@ namespace
(&ChoiceValueStringishMembers<ChoiceNameWithPrefix, &ChoiceValue::name_with_prefix>::fetch)), 0);
rb_define_method(c_choice_value, "enabled?", RDOC_IS_STUPID(choice_value_enabled,
(&ChoiceValueBoolishMembers<bool, &ChoiceValue::enabled>::fetch)), 0);
+ rb_define_method(c_choice_value, "enabled_by_default?", RDOC_IS_STUPID(choice_value_enabled_by_default,
+ (&ChoiceValueBoolishMembers<bool, &ChoiceValue::enabled_by_default>::fetch)), 0);
rb_define_method(c_choice_value, "locked?", RDOC_IS_STUPID(choice_value_locked,
(&ChoiceValueBoolishMembers<bool, &ChoiceValue::locked>::fetch)), 0);
rb_define_method(c_choice_value, "description", RDOC_IS_STUPID(choice_value_description,
diff --git a/ruby/choice_TEST.rb b/ruby/choice_TEST.rb
index ff57367..1dd94d9 100644
--- a/ruby/choice_TEST.rb
+++ b/ruby/choice_TEST.rb
@@ -174,6 +174,12 @@ module Paludis
assert ! linguas_en.enabled?
end
+ def test_enabled_by_default
+ assert use_flag1.enabled_by_default?
+ assert ! use_flag2.enabled_by_default?
+ assert ! linguas_en.enabled_by_default?
+ end
+
def test_locked
assert ! use_flag1.locked?
assert ! use_flag2.locked?