Class: TaggedText

Inherits:
Object
  • Object
show all
Extended by:
InstanceMethods
Defined in:
lib/lumix/model/base_models.rb,
lib/lumix/model/mock_models.rb,
lib/lumix/model/maglev_models.rb,
lib/lumix/model/sequel_models.rb

Defined Under Namespace

Modules: InstanceMethods

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from InstanceMethods

create

Constructor Details

#initialize(attrs) ⇒ TaggedText

Returns a new instance of TaggedText.



23
24
25
26
# File 'lib/lumix/model/base_models.rb', line 23

def initialize(attrs)
  @id = attrs.delete(:id)
  @attrs = attrs
end

Class Attribute Details

.dbObject

Returns the value of attribute db.



14
15
16
# File 'lib/lumix/model/sequel_models.rb', line 14

def db
  @db
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



27
28
29
# File 'lib/lumix/model/base_models.rb', line 27

def id
  @id
end

Class Method Details

.[](key) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/lumix/model/mock_models.rb', line 23

def [](key)
  case key
  when Hash
    # find by values

  when Integer
    table[key]
  when String
    # find by filename
  end
end

.countObject



41
42
# File 'lib/lumix/model/mock_models.rb', line 41

def count
end

.each(&block) ⇒ Object



19
20
21
# File 'lib/lumix/model/mock_models.rb', line 19

def each(&block)
  table.each &block
end

.exists?(attrs) ⇒ Boolean

Returns:

  • (Boolean)


35
36
# File 'lib/lumix/model/mock_models.rb', line 35

def exists?(attrs)
end

.idsObject



38
39
# File 'lib/lumix/model/mock_models.rb', line 38

def ids
end

.tableObject



15
16
17
# File 'lib/lumix/model/mock_models.rb', line 15

def table
  @@table ||= []
end

Instance Method Details

#saveObject



5
6
7
# File 'lib/lumix/model/mock_models.rb', line 5

def save
  # data aware ;)
end

#save_newObject



9
10
11
# File 'lib/lumix/model/mock_models.rb', line 9

def save_new
  self.class.table << self
end

#update(attrs) ⇒ Object



30
31
32
33
# File 'lib/lumix/model/base_models.rb', line 30

def update(attrs)
  @attrs.merge(attrs)
  save
end