Class: MetaBuilder
- Inherits:
-
Object
- Object
- MetaBuilder
- Defined in:
- lib/MetaBuilder.rb
Class Method Summary collapse
-
.create(value) ⇒ Object
Create meta.
-
.create_many(values) ⇒ Object
Create meta for multiple values.
- .data_type_to_meta_type(value) ⇒ Object
Class Method Details
.create(value) ⇒ Object
Create meta.
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 |
# File 'lib/MetaBuilder.rb', line 19 def self.create(value) = nil data_type = value.class.to_s # Create meta type for matching data type. case data_type when "Array" = ArrayMeta.new() when "TrueClass", "FalseClass" = BooleanMeta.new() when "Float" = FloatMeta.new() when "Integer" = IntegerMeta.new() when "String" = StringMeta.new() end unless .nil? .load(value) end return end |
.create_many(values) ⇒ Object
Create meta for multiple values.
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/MetaBuilder.rb', line 51 def self.create_many(values) = [] values.each do |value| << self.create(value) end return end |
.data_type_to_meta_type(value) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/MetaBuilder.rb', line 66 def self.(value) data_type = value.class = { Array => :array, TrueClass => :bool, FalseClass => :bool, Float => :float, Integer => :int, NilClass => :null, String => :string } return [data_type] end |