Project

General

Profile

Feature #17718

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

```ruby 
 def get_perdiem(city: nil, state: nil, zip:nil) 

   case parameters_match    # (return an object of the parameters we can pattern match on) 
   in {zip: zip} 
      find_perdiem_by_zip(zip) 
   in {state: s, city: c} 
      find_perdiem_by_state_and_city(s, c) 
   in { state: s} 
      find_perdiem_by_state(s) 
   else 
      raise 'need combination of zip, city,state' 
   end 
 end 
 ```

Back