Sha256: d8f0449560e2bdc04dd7cc9da56aa8327f92fc956fd8bc3e8ac71da0ad14ba25
Contents?: true
Size: 958 Bytes
Versions: 3
Compression:
Stored size: 958 Bytes
Contents
require_relative "symbol_container.rb" module Docks module Containers class Variation < Symbol def self.type; "variation" end def initialize(variation_hash = {}) super set_defaults end def has_demo? [Types::Demo::OWN, Types::Demo::JOINT].include?(demo_type) end protected def matches_exactly?(descriptor) super || (descriptor.member? && descriptor.member == fetch(:name) && descriptor.symbol == fetch(:for, nil)) end def set_defaults self[:active] = false if self[:active].nil? self[:demo_type] ||= Types::Demo::SELECT [:activate_with, :preclude, :set_by, :include_with].each do |defaults_to_array| value = self[defaults_to_array] self[defaults_to_array] = case value when NilClass then [] when Array then value else [value] end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
docks_app-0.0.3 | lib/docks/containers/variation_container.rb |
docks_app-0.0.2 | lib/docks/containers/variation_container.rb |
docks_app-0.0.1 | lib/docks/containers/variation_container.rb |