Module: Jubatus::Common
- Included in:
- Anomaly::Client::Anomaly, Anomaly::IdWithScore, Bandit::ArmInfo, Bandit::Client::Bandit, Burst::Batch, Burst::Client::Burst, Burst::Document, Burst::KeywordWithParams, Burst::Window, Jubatus::Classifier::Client::Classifier, Jubatus::Classifier::EstimateResult, Jubatus::Classifier::LabeledDatum, Jubatus::Clustering::Client::Clustering, Jubatus::Clustering::IndexedPoint, Jubatus::Clustering::WeightedDatum, Jubatus::Clustering::WeightedIndex, Datum, Graph::Client::Graph, Graph::Edge, Graph::Node, Graph::PresetQuery, Graph::Query, Graph::ShortestPathQuery, NearestNeighbor::Client::NearestNeighbor, NearestNeighbor::IdWithScore, Recommender::Client::Recommender, Recommender::IdWithScore, Regression::Client::Regression, Regression::ScoredDatum, Stat::Client::Stat, Weight::Client::Weight, Weight::Feature
- Defined in:
- lib/jubatus/common/datum.rb,
lib/jubatus/common/types.rb,
lib/jubatus/common/client.rb,
lib/jubatus/common/message_string_generator.rb
Defined Under Namespace
Classes: Client, ClientBase, Datum, InterfaceMismatch, MessageStringGenerator, TBool, TDatum, TEnum, TFloat, TInt, TList, TMap, TNullable, TObject, TPrimitive, TRaw, TString, TTuple, TUserDef, TypeError, TypeMismatch, UnknownMethod, ValueError
Class Method Summary
collapse
Class Method Details
.check_type(value, typ) ⇒ Object
7
8
9
10
11
|
# File 'lib/jubatus/common/types.rb', line 7
def self.check_type(value, typ)
if not (typ === value)
raise TypeError, "type %s is expected, but %s is given" % [typ, value.class]
end
end
|
.check_types(value, types) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/jubatus/common/types.rb', line 13
def self.check_types(value, types)
types.each do |t|
return if t === value
end
t = types.map { |t| t.to_s }.join(", ")
raise TypeError, "type %s is expected, but %s is given" % [t, value.class]
end
|