Class: Safrano::Select

Inherits:
SelectBase show all
Defined in:
lib/odata/select.rb

Overview

single select

Constant Summary collapse

COMASPLIT =
/\s*,\s*/.freeze

Constants inherited from SelectBase

Safrano::SelectBase::ALL

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from SelectBase

#all_props?, factory

Constructor Details

#initialize(selstr, model) ⇒ Select

Returns a new instance of Select.



44
45
46
47
48
# File 'lib/odata/select.rb', line 44

def initialize(selstr, model)
  @model = model
  @selectp = selstr.strip
  @props = @selectp.split(COMASPLIT)
end

Instance Attribute Details

#propsObject (readonly)

Returns the value of attribute props.



42
43
44
# File 'lib/odata/select.rb', line 42

def props
  @props
end

Instance Method Details

#parse_error?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/odata/select.rb', line 50

def parse_error?
  (invalids = @model.find_invalid_props(props.to_set)) ? BadRequestSelectInvalidProps.new(@model, invalids) : Contract::OK
end