Class: Reflekt::Meta

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMeta

Each meta defines its type.


19
20
21
# File 'lib/meta.rb', line 19

def initialize()
  @type = :null
end

Class Method Details

.deserialize(meta) ⇒ Object

Deserialize metadata.

TODO: Deserialize should create a Meta object. TODO: Require each Meta type to handle its own deserialization.

Parameters:

  • meta (Hash)

    The metadata to deserialize.

  • meta (Hash)

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/meta.rb', line 53

def self.deserialize(meta)
  # Convert nil meta into NullMeta.
  # Meta is nil when there are no @inputs or @output on the method.
  if meta.nil?
    return NullMeta.new().serialize()
  end

  # Symbolize keys.
  # TODO: Remove once "Fix Rowdb.get(path)" bug fixed.
  meta = meta.transform_keys(&:to_sym)

  # Symbolize type value.
  meta[:type] = meta[:type].to_sym

  return meta
end

.numeric?(value) ⇒ Boolean

Returns:

  • (Boolean)

70
71
72
# File 'lib/meta.rb', line 70

def self.numeric? value
  Float(value) != nil rescue false
end

Instance Method Details

#load(value) ⇒ Object

Each meta loads values.

Parameters:

  • value (Dynamic)

28
29
# File 'lib/meta.rb', line 28

def load(value)
end

#serializeHash

Returns:

  • (Hash)

34
35
36
37
38
# File 'lib/meta.rb', line 34

def serialize()
  {
    :type => @type
  }
end