Class: CqlRuby::NestRule
- Inherits:
-
Struct
- Object
- Struct
- CqlRuby::NestRule
- Defined in:
- lib/cql_ruby/filter_reader.rb
Constant Summary collapse
- NAME_ANY =
'*'- ALLOWED_TYPE =
%w[class module def block].freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
4 5 6 |
# File 'lib/cql_ruby/filter_reader.rb', line 4 def name @name end |
#type ⇒ Object
Returns the value of attribute type
4 5 6 |
# File 'lib/cql_ruby/filter_reader.rb', line 4 def type @type end |
Class Method Details
.from(raw_value) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/cql_ruby/filter_reader.rb', line 14 def from(raw_value) type, name = raw_value.split('=') name ||= NAME_ANY raise "Unknown type: #{type}. Allowed: #{ALLOWED_TYPE}" unless ALLOWED_TYPE.include?(type) raise "Type #{type} cannot have a name." if %w[block].include?(type) && name != NAME_ANY new(type, name) end |
Instance Method Details
#restrict_name? ⇒ Boolean
25 26 27 |
# File 'lib/cql_ruby/filter_reader.rb', line 25 def restrict_name? name != NAME_ANY end |