Class: OData::AbstractQuery::Option

Inherits:
BasicOption show all
Defined in:
lib/o_data/abstract_query/option.rb

Instance Attribute Summary

Attributes inherited from BasicOption

#key, #query, #value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BasicOption

#inspect

Constructor Details

#initialize(query, key, value = nil) ⇒ Option

Returns a new instance of Option.



34
35
36
37
38
39
# File 'lib/o_data/abstract_query/option.rb', line 34

def initialize(query, key, value = nil)
  super(query, key, value)
  
  raise Errors::InvalidOptionContext.new(self.query, self) unless applies_to?
  raise Errors::InvalidOptionValue.new(self.query, self) unless valid?
end

Class Method Details

.applies_to?(query) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/o_data/abstract_query/option.rb', line 41

def self.applies_to?(query)
  false
end

.option_nameObject



26
27
28
# File 'lib/o_data/abstract_query/option.rb', line 26

def self.option_name
  name.to_s.demodulize.sub(/Option$/, '')
end

.parse!(query, key, value = nil) ⇒ Object



45
46
47
# File 'lib/o_data/abstract_query/option.rb', line 45

def self.parse!(query, key, value = nil)
  nil
end

Instance Method Details

#applies_to?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/o_data/abstract_query/option.rb', line 49

def applies_to?
  self.class.applies_to?(self.query)
end

#option_nameObject



30
31
32
# File 'lib/o_data/abstract_query/option.rb', line 30

def option_name
  self.class.option_name
end

#valid?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/o_data/abstract_query/option.rb', line 53

def valid?
  true
end