From f362cbdd6d28c5d1d8da6e46e4666fe9cf227a8f Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 20 Jan 2017 15:23:20 +0100 Subject: [PATCH] Add r_get_location() for RFileLockEntry --- libimagruby/src/store.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/libimagruby/src/store.rs b/libimagruby/src/store.rs index ba3a8343..827c3ce6 100644 --- a/libimagruby/src/store.rs +++ b/libimagruby/src/store.rs @@ -17,6 +17,11 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // +use ruru::AnyObject; +trait Wrap { + fn wrap(self) -> AnyObject; +} + #[allow(unused_variables)] pub mod storeid { use std::path::PathBuf; @@ -28,6 +33,13 @@ pub mod storeid { wrappable_struct!(StoreId, StoreIdWrapper, STOREID_WRAPPER); class!(RStoreId); + use store::Wrap; + impl Wrap for StoreId { + fn wrap(self) -> AnyObject { + Class::from_existing("RStoreId").wrap_data(self, &*STOREID_WRAPPER) + } + } + methods!( RStoreId, itself, @@ -167,6 +179,7 @@ pub mod store { use ruby_utils::IntoToml; use toml_utils::IntoRuby; + use store::Wrap; pub struct FLECustomWrapper(Box>); @@ -187,6 +200,15 @@ pub mod store { wrappable_struct!(FLECustomWrapper, FileLockEntryWrapper, FLE_WRAPPER); class!(RFileLockEntry); + methods!( + RFileLockEntry, + itself, + + fn r_get_location() -> AnyObject { + itself.get_data(&*FLE_WRAPPER).get_location().clone().wrap() + } + ); + wrappable_struct!(EntryHeader, EntryHeaderWrapper, ENTRY_HEADER_WRAPPER); class!(REntryHeader); methods!(