Class: CqlRuby::NodeSpec

Inherits:
Struct
  • Object
show all
Defined in:
lib/cql_ruby/filter_reader.rb

Constant Summary collapse

NAME_ANY =

Make this non duplicated.

'*'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



6
7
8
# File 'lib/cql_ruby/filter_reader.rb', line 6

def name
  @name
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



6
7
8
# File 'lib/cql_ruby/filter_reader.rb', line 6

def type
  @type
end

Class Method Details

.from(raw_value) ⇒ Object

Parameters:

  • raw_value (String)

    Format: TYPE(=NAME|=*) Accepted types: class, module, def, block



16
17
18
19
20
21
22
23
# File 'lib/cql_ruby/filter_reader.rb', line 16

def from(raw_value)
  type, name = raw_value.split('=')
  name ||= NAME_ANY

  raise "Type '#{type}' is not recognized. See 'cql_ruby --help' for allowed types." unless Parser::Meta::NODE_TYPES.member?(type.to_sym)

  new(type, name)
end

Instance Method Details

#restrict_name?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/cql_ruby/filter_reader.rb', line 26

def restrict_name?
  name != NAME_ANY
end