Class: Sieve

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/skynet-core/db/ibrands.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.by_brand(brand, url_type = nil) ⇒ Object



178
179
180
181
182
183
184
# File 'lib/skynet-core/db/ibrands.rb', line 178

def self.by_brand(brand, url_type = nil)
  if url_type.blank?
    self.all :conditions => ["brand_id = ?", brand.id]
  else
    self.all :conditions => ["brand_id = ? AND url_type = ?", brand.id, url_type]
  end
end

Instance Method Details

#mining_is_not_ok!Object



173
174
175
176
# File 'lib/skynet-core/db/ibrands.rb', line 173

def mining_is_not_ok!
  self.state = 'registred' if self.state == 'in_processing'
  self.save
end

#mining_is_ok!Object



164
165
166
167
# File 'lib/skynet-core/db/ibrands.rb', line 164

def mining_is_ok!
  self.state = 'passive' if self.state == 'in_processing'
  self.save
end

#passive?Boolean

Returns:

  • (Boolean)


169
170
171
# File 'lib/skynet-core/db/ibrands.rb', line 169

def passive?
  self.state == 'passive'
end

#processing!Object



155
156
157
158
# File 'lib/skynet-core/db/ibrands.rb', line 155

def processing!
  self.state = 'in_processing' if self.state == 'passive'
  self.save
end

#processing?Boolean

Returns:

  • (Boolean)


160
161
162
# File 'lib/skynet-core/db/ibrands.rb', line 160

def processing?
  self.state == 'in_processing'
end