Class: Sow::Fields

Inherits:
Object
  • Object
show all
Defined in:
lib/seed_drill/utils.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = nil, &block) ⇒ Fields

Returns a new instance of Fields


5
6
7
8
9
10
11
12
# File 'lib/seed_drill/utils.rb', line 5

def initialize(args = nil, &block)
  fixed = Hasher.new
  variant = Hasher.new
  variant.instance_exec(fixed, &block) if block_given?
  @fixed = args || {}
  @fixed.merge!(fixed.hash || {})
  @variant = variant.hash || {}
end

Instance Attribute Details

#fixedObject (readonly)

Returns the value of attribute fixed


3
4
5
# File 'lib/seed_drill/utils.rb', line 3

def fixed
  @fixed
end

Instance Method Details

#procObject


18
19
20
# File 'lib/seed_drill/utils.rb', line 18

def proc
  @variant.select{|k,v| v.instance_of?(Proc) }
end

#variantObject


14
15
16
# File 'lib/seed_drill/utils.rb', line 14

def variant
  @variant.reject{|k,v| v.instance_of?(Proc) }
end