mustmodify / valuable

quick ruby modeling -- basically attr_accessor with default values, light-weight casting, and a constructor
http://valuable.mustmodify.com/
MIT License
72 stars 3 forks source link

Allow resetting defaults #25

Open mustmodify opened 8 years ago

mustmodify commented 8 years ago
class TravelEstimationService < Valuable
  has_collection :resources
end

if CONFIG[:live]    
  TravelEstimationService.set_default(:resources => [ MappingProvider::RouteInfo ]
end
mustmodify commented 6 years ago

Another example:

class GenericInterface < Valuable
  has_value :encoding, default: 'UTF-8'
end

class ActualInterface < GenericInterface
  set_default encoding: 'ISO-8859-1'
end