Method: LibGems::Specification#assign_defaults
- Defined in:
- lib/libgems/specification.rb
#assign_defaults ⇒ Object
Each attribute has a default value (possibly nil). Here, we initialize all attributes to their default value. This is done through the accessor methods, so special behaviours will be honored. Furthermore, we take a copy of the default so each specification instance has its own empty arrays, etc.
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
# File 'lib/libgems/specification.rb', line 452 def assign_defaults @@nil_attributes.each do |name| instance_variable_set name, nil end @@non_nil_attributes.each do |name, default| value = case default when Time, Numeric, Symbol, true, false, nil then default else default.dup end instance_variable_set name, value end # HACK instance_variable_set :@new_platform, LibGems::Platform::RUBY end |