Class: Reamaze::Opinionated::Definition

Inherits:
Object
  • Object
show all
Defined in:
lib/opinionated/definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Definition

Returns a new instance of Definition.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/opinionated/definition.rb', line 13

def initialize(name, options = {})
  @name = name

  if options.has_key?(:type_check)
    @has_type_check = true
    @type_check = options[:type_check].instance_of?(Array) ? options[:type_check] : [options[:type_check]]
  end

  if options.has_key?(:validate)
    @has_validate = true
    @validate = options[:validate]
  end

  if options.has_key?(:default)
    @has_default = true
    @default = options[:default]
  end

  if options.has_key?(:default_through)
    @has_default_through = true
    @default_through = options[:default_through]
  end

  if options.has_key?(:default_dynamic)
    @has_default_dynamic = true
    @default_dynamic = options[:default_dynamic]
  end

  if options.has_key?(:preprocess)
    @has_preprocess = true
    @preprocess = options[:preprocess]
  end

  if options.has_key?(:postprocess)
    @has_postprocess = true
    @postprocess = options[:postprocess]
  end

end

Instance Attribute Details

#defaultObject

Returns the value of attribute default.



7
8
9
# File 'lib/opinionated/definition.rb', line 7

def default
  @default
end

#default_dynamicObject

Returns the value of attribute default_dynamic.



9
10
11
# File 'lib/opinionated/definition.rb', line 9

def default_dynamic
  @default_dynamic
end

#default_throughObject

Returns the value of attribute default_through.



8
9
10
# File 'lib/opinionated/definition.rb', line 8

def default_through
  @default_through
end

#has_defaultObject

Returns the value of attribute has_default.



7
8
9
# File 'lib/opinionated/definition.rb', line 7

def has_default
  @has_default
end

#has_default_dynamicObject

Returns the value of attribute has_default_dynamic.



9
10
11
# File 'lib/opinionated/definition.rb', line 9

def has_default_dynamic
  @has_default_dynamic
end

#has_default_throughObject

Returns the value of attribute has_default_through.



8
9
10
# File 'lib/opinionated/definition.rb', line 8

def has_default_through
  @has_default_through
end

#has_postprocessObject

Returns the value of attribute has_postprocess.



11
12
13
# File 'lib/opinionated/definition.rb', line 11

def has_postprocess
  @has_postprocess
end

#has_preprocessObject

Returns the value of attribute has_preprocess.



10
11
12
# File 'lib/opinionated/definition.rb', line 10

def has_preprocess
  @has_preprocess
end

#has_type_checkObject

Returns the value of attribute has_type_check.



5
6
7
# File 'lib/opinionated/definition.rb', line 5

def has_type_check
  @has_type_check
end

#has_validateObject

Returns the value of attribute has_validate.



6
7
8
# File 'lib/opinionated/definition.rb', line 6

def has_validate
  @has_validate
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/opinionated/definition.rb', line 4

def name
  @name
end

#postprocessObject

Returns the value of attribute postprocess.



11
12
13
# File 'lib/opinionated/definition.rb', line 11

def postprocess
  @postprocess
end

#preprocessObject

Returns the value of attribute preprocess.



10
11
12
# File 'lib/opinionated/definition.rb', line 10

def preprocess
  @preprocess
end

#type_checkObject

Returns the value of attribute type_check.



5
6
7
# File 'lib/opinionated/definition.rb', line 5

def type_check
  @type_check
end

#validateObject

Returns the value of attribute validate.



6
7
8
# File 'lib/opinionated/definition.rb', line 6

def validate
  @validate
end