Add BSD::Control.library_version
This commit is contained in:
parent
c94d705f4d
commit
2db227b0c3
3 changed files with 16 additions and 1 deletions
|
@ -26,6 +26,14 @@ ffi_available_features(VALUE self)
|
||||||
return features;
|
return features;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
ffi_library_version(VALUE self)
|
||||||
|
{
|
||||||
|
const char *ver;
|
||||||
|
ver = hbsdcontrol_get_version();
|
||||||
|
return rb_str_new2(ver);
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
feature_set(VALUE self, VALUE path, VALUE state)
|
feature_set(VALUE self, VALUE path, VALUE state)
|
||||||
{
|
{
|
||||||
|
@ -65,5 +73,6 @@ Init_hbsdctl(void)
|
||||||
rb_define_const(rb_mControl, "Disable", 0);
|
rb_define_const(rb_mControl, "Disable", 0);
|
||||||
rb_define_const(rb_mControl, "Enable", 1);
|
rb_define_const(rb_mControl, "Enable", 1);
|
||||||
rb_define_singleton_method(rb_mFFI, "available_features", ffi_available_features, 0);
|
rb_define_singleton_method(rb_mFFI, "available_features", ffi_available_features, 0);
|
||||||
|
rb_define_singleton_method(rb_mFFI, "library_version", ffi_library_version, 0);
|
||||||
rb_define_method(rb_cFeature, "set!", feature_set, 2);
|
rb_define_method(rb_cFeature, "set!", feature_set, 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,13 @@ module BSD::Control
|
||||||
require_relative "control/feature"
|
require_relative "control/feature"
|
||||||
Error = Class.new(RuntimeError)
|
Error = Class.new(RuntimeError)
|
||||||
|
|
||||||
|
##
|
||||||
|
# @return [String]
|
||||||
|
# Returns the version of libhbsdcontrol.
|
||||||
|
def self.library_version
|
||||||
|
FFI.library_version
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# @return [Array<BSD::Control::Feature>]
|
# @return [Array<BSD::Control::Feature>]
|
||||||
def self.available_features
|
def self.available_features
|
||||||
|
|
|
@ -124,6 +124,5 @@ module BSD::Control
|
||||||
end
|
end
|
||||||
|
|
||||||
# @endgroup
|
# @endgroup
|
||||||
private :set!
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue