Module: ActiveGraph::Shared::DeclaredProperty::Index
- Included in:
 - ActiveGraph::Shared::DeclaredProperty
 
- Defined in:
 - lib/active_graph/shared/declared_property/index.rb
 
Overview
None of these methods interact with the database. They only keep track of property settings in models. It could (should?) handle the actual indexing/constraining, but that’s TBD.
Instance Method Summary collapse
- #constraint!(type = :unique) ⇒ Object
 - #constraint?(type = :unique) ⇒ Boolean
 - #index!(type = :exact) ⇒ Object
 - #index?(type = :exact) ⇒ Boolean
 - #index_or_constraint? ⇒ Boolean
 - #unconstraint!(type = :unique) ⇒ Object
 - #unindex!(type = :exact) ⇒ Object
 
Instance Method Details
#constraint!(type = :unique) ⇒ Object
      23 24 25 26  | 
    
      # File 'lib/active_graph/shared/declared_property/index.rb', line 23 def constraint!(type = :unique) fail ActiveGraph::InvalidPropertyOptionsError, "Can't set constraint on indexed property #{name} (constraints get indexes automatically)" if index?(:exact) [:constraint] = type end  | 
  
#constraint?(type = :unique) ⇒ Boolean
      14 15 16  | 
    
      # File 'lib/active_graph/shared/declared_property/index.rb', line 14 def constraint?(type = :unique) .key?(:constraint) && [:constraint] == type end  | 
  
#index!(type = :exact) ⇒ Object
      18 19 20 21  | 
    
      # File 'lib/active_graph/shared/declared_property/index.rb', line 18 def index!(type = :exact) fail ActiveGraph::InvalidPropertyOptionsError, "Can't set index on constrainted property #{name} (constraints get indexes automatically)" if constraint?(:unique) [:index] = type end  | 
  
#index?(type = :exact) ⇒ Boolean
      10 11 12  | 
    
      # File 'lib/active_graph/shared/declared_property/index.rb', line 10 def index?(type = :exact) .key?(:index) && [:index] == type end  | 
  
#index_or_constraint? ⇒ Boolean
      6 7 8  | 
    
      # File 'lib/active_graph/shared/declared_property/index.rb', line 6 def index_or_constraint? index?(:exact) || constraint?(:unique) end  | 
  
#unconstraint!(type = :unique) ⇒ Object
      32 33 34  | 
    
      # File 'lib/active_graph/shared/declared_property/index.rb', line 32 def unconstraint!(type = :unique) .delete(:constraint) if constraint?(type) end  | 
  
#unindex!(type = :exact) ⇒ Object
      28 29 30  | 
    
      # File 'lib/active_graph/shared/declared_property/index.rb', line 28 def unindex!(type = :exact) .delete(:index) if index?(type) end  |