Impl r_entry_header_get()
This commit is contained in:
parent
6767e44ed1
commit
197f4cb6f2
1 changed files with 20 additions and 0 deletions
|
@ -237,6 +237,26 @@ pub mod store {
|
|||
}
|
||||
}
|
||||
|
||||
fn r_entry_header_get(spec: RString) -> AnyObject {
|
||||
use ruru::NilClass;
|
||||
|
||||
if let Err(ref error) = spec { // raise exception if "spec" is not a String
|
||||
VM::raise(error.to_exception(), error.description());
|
||||
return Boolean::new(false).to_any_object();
|
||||
}
|
||||
|
||||
let spec = spec.unwrap().to_string(); // safe because of check above.
|
||||
|
||||
match itself.get_data(&*ENTRY_HEADER_WRAPPER).read(&spec) {
|
||||
Ok(Some(v)) => v.into_ruby(),
|
||||
Ok(None) => NilClass::new().to_any_object(),
|
||||
Err(e) => {
|
||||
VM::raise(Class::from_existing("RuntimeError"), e.description());
|
||||
return Boolean::new(false).to_any_object();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
wrappable_struct!(EntryContent, EntryContentWrapper, ENTRY_CONTENT_WRAPPER);
|
||||
|
|
Loading…
Reference in a new issue