-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
344 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
################################################################################ | ||
# Meta for input and output. All meta behave the same. | ||
# | ||
# @pattern Abstract class. | ||
# @see lib/meta for each meta. | ||
################################################################################ | ||
|
||
class Meta | ||
|
||
## | ||
# Each meta loads values. | ||
# | ||
# @param value [Dynamic] | ||
## | ||
def load(value) | ||
end | ||
|
||
## | ||
# Each meta provides metadata. | ||
# | ||
# @return [Hash] | ||
## | ||
def result() | ||
{} | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
################################################################################ | ||
# Create Meta. | ||
# | ||
# @pattern Builder. | ||
# @see lib/meta for each meta. | ||
################################################################################ | ||
|
||
require 'Meta' | ||
require_relative './meta/IntegerMeta' | ||
require_relative './meta/StringMeta' | ||
|
||
class MetaBuilder | ||
|
||
## | ||
# Create meta. | ||
# | ||
# @param value | ||
## | ||
def self.create(value) | ||
|
||
meta = nil | ||
|
||
# Creates values for matching data type. | ||
case value.class.to_s | ||
when "Integer" | ||
meta = IntegerMeta.new() | ||
when "String" | ||
meta = StringMeta.new() | ||
end | ||
|
||
unless meta.nil? | ||
meta.load(value) | ||
end | ||
|
||
return meta | ||
|
||
end | ||
|
||
## | ||
# Create meta for multiple values. | ||
# | ||
# @param values | ||
## | ||
def self.create_many(values) | ||
|
||
meta = [] | ||
|
||
values.each do |value| | ||
meta << self.create(value) | ||
end | ||
|
||
return meta | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.