Class: Genome::Core::Helpers::PropertyConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/genome/core/helpers/property_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ PropertyConfig

Returns a new instance of PropertyConfig.



7
8
9
10
# File 'lib/genome/core/helpers/property_config.rb', line 7

def initialize(options = {})
  @settable = options[:settable]
  @nullable = options[:nullable]
end

Instance Attribute Details

#nullableObject (readonly) Also known as: nullable?

Returns the value of attribute nullable.



5
6
7
# File 'lib/genome/core/helpers/property_config.rb', line 5

def nullable
  @nullable
end

#settableObject (readonly) Also known as: settable?

Returns the value of attribute settable.



5
6
7
# File 'lib/genome/core/helpers/property_config.rb', line 5

def settable
  @settable
end

Instance Method Details

#to_hObject



19
20
21
22
23
24
# File 'lib/genome/core/helpers/property_config.rb', line 19

def to_h
  {
    settable: settable,
    nullable: nullable
  }
end

#valid?(property_value) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
# File 'lib/genome/core/helpers/property_config.rb', line 13

def valid?(property_value)
  return false if !nullable && property_value == nil

  true
end