mirror of
https://github.com/tiffany352/rink-rs
synced 2024-11-10 13:44:15 +00:00
Handle units ending with 's'
This commit is contained in:
parent
6d7daef125
commit
51a67f7984
1 changed files with 5 additions and 0 deletions
|
@ -103,6 +103,11 @@ impl Context {
|
|||
|
||||
pub fn lookup(&self, name: &str) -> Option<Value> {
|
||||
self.units.get(name).cloned().or_else(|| {
|
||||
if name.ends_with("s") {
|
||||
if let Some(v) = self.lookup(&name[0..name.len()-1]) {
|
||||
return Some(v)
|
||||
}
|
||||
}
|
||||
for &(ref pre, value) in &self.prefixes {
|
||||
if name.starts_with(pre) {
|
||||
if let Some(mut v) = self.lookup(&name[pre.len()..]) {
|
||||
|
|
Loading…
Reference in a new issue