Sha256: 982fc4fd1a8e5b6e0cece41ea695e4908d603fe895798d49a78a06e135a8a66d
Contents?: true
Size: 925 Bytes
Versions: 3
Compression:
Stored size: 925 Bytes
Contents
module Danica module VariablesHolder extend ::ActiveSupport::Concern require 'danica/variables_holder/variables_builder' included do class << self def variables(*names) VariablesBuilder.new(names, self).build end def variables_names @variables_names ||= ( (superclass.try(:variables_names) || []) + [] ) end end end attr_accessor :variables def variables=(variables) @variables = variables.map { |v| wrap_value(v) } end def variables @variables ||= variables_hash.values end def variables_hash @variabels_map ||= (@variables || []).as_hash(self.class.variables_names) end def variables_value_hash variables.map(&:value).as_hash(self.class.variables_names) end private def non_valued_variables variables.reject(&:valued?) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
danica-2.3.1 | lib/danica/variables_holder.rb |
danica-2.3.0 | lib/danica/variables_holder.rb |
danica-2.2.1 | lib/danica/variables_holder.rb |