Skip to content

Commit

Permalink
move one_of from TypeBuilder to StoreModel itself
Browse files Browse the repository at this point in the history
  • Loading branch information
HolyWalley committed Jun 3, 2020
1 parent c283de3 commit 9f06ee6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 8 additions & 0 deletions lib/store_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,13 @@ class << self
def config
@config ||= Configuration.new
end

# TODO: add documentation
def one_of(&block)
Class.new do
define_singleton_method(:to_type) { Types::PolymorphicType.new(block) }
define_singleton_method(:to_array_type) { Types::PolymorphicArrayType.new(block) }
end
end
end
end
8 changes: 0 additions & 8 deletions lib/store_model/type_builders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,5 @@ def to_type
def to_array_type
Types::ArrayType.new(self)
end

# TODO: add documentation
def one_of(&block)
Class.new do
define_singleton_method(:to_type) { Types::PolymorphicType.new(block) }
define_singleton_method(:to_array_type) { }
end
end
end
end

0 comments on commit 9f06ee6

Please sign in to comment.