lib/pione/model/feature-expr.rb in pione-0.1.3 vs lib/pione/model/feature-expr.rb in pione-0.1.4
- old
+ new
@@ -50,11 +50,11 @@
boundless ||= BoundlessFeature.new
end
end
# Expr is a super class for all feature expressions.
- class Expr < BasicModel
+ class Expr < Callable
set_pione_model_type TypeFeature
# Return simplified expression.
#
# @return [Expr]
@@ -863,21 +863,30 @@
return match(_provider, _request)
end
end
end
end
+
+ # class FeatureSequence < Sequence
+ # set_pione_model_type TypeFeature
+ # set_element_class Feature::Expr
+ # end
end
TypeFeature.instance_eval do
define_pione_method("==", [TypeFeature], TypeBoolean) do |rec, other|
- PioneBoolean.new(rec == other)
+ PioneBoolean.new(rec == other).to_seq
end
define_pione_method("!=", [TypeFeature], TypeBoolean) do |rec, other|
- PioneBoolean.not(rec.call_pione_method("==", other))
+ PioneBoolean.not(rec.call_pione_method("==", other)).to_seq
end
define_pione_method("as_string", [], TypeString) do |rec|
- PioneString.new(rec.as_string)
+ PioneString.new(rec.as_string).to_seq
+ end
+
+ define_pione_method("str", [], TypeString) do |rec|
+ rec.call_pione_method("as_string")
end
end
end