Class: Reflekt::Meta
- Inherits:
-
Object
- Object
- Reflekt::Meta
- Defined in:
- lib/meta.rb
Direct Known Subclasses
ArrayMeta, BooleanMeta, FloatMeta, IntegerMeta, NullMeta, ObjectMeta, StringMeta
Class Method Summary collapse
-
.deserialize(meta) ⇒ Object
Deserialize metadata.
- .numeric?(value) ⇒ Boolean
Instance Method Summary collapse
-
#initialize ⇒ Meta
constructor
Each meta defines its type.
-
#load(value) ⇒ Object
Each meta loads values.
- #serialize ⇒ Hash
Constructor Details
#initialize ⇒ Meta
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.
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() # Convert nil meta into NullMeta. # Meta is nil when there are no @inputs or @output on the method. if .nil? return NullMeta.new().serialize() end # Symbolize keys. # TODO: Remove once "Fix Rowdb.get(path)" bug fixed. = .transform_keys(&:to_sym) # Symbolize type value. [:type] = [:type].to_sym return end |
.numeric?(value) ⇒ 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.
28 29 |
# File 'lib/meta.rb', line 28 def load(value) end |
#serialize ⇒ Hash
34 35 36 37 38 |
# File 'lib/meta.rb', line 34 def serialize() { :type => @type } end |