Sha256: bdbcf48f10f60d6b9a65a769928525db69f6be683f233fdb7aee4d8f5b9bc28c
Contents?: true
Size: 448 Bytes
Versions: 1
Compression:
Stored size: 448 Bytes
Contents
module IngredientParser class Ingredient attr_reader :name, :amount def initialize(name, amount) @name = normalize(name) @amount = normalize(amount) end private def normalize(value) case value when NilClass nil when Parslet::Slice value.str.strip when String if value.empty? nil else value.strip end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ingredient_parser-0.1.0 | lib/ingredient_parser/ingredient.rb |