Class: TaggedText
- Inherits:
-
Object
- Object
- TaggedText
- 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
-
.db ⇒ Object
Returns the value of attribute db.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
- .[](key) ⇒ Object
- .count ⇒ Object
- .each(&block) ⇒ Object
- .exists?(attrs) ⇒ Boolean
- .ids ⇒ Object
- .table ⇒ Object
Instance Method Summary collapse
-
#initialize(attrs) ⇒ TaggedText
constructor
A new instance of TaggedText.
- #save ⇒ Object
- #save_new ⇒ Object
- #update(attrs) ⇒ Object
Methods included from InstanceMethods
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
.db ⇒ Object
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
#id ⇒ Object (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 |
.count ⇒ Object
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
35 36 |
# File 'lib/lumix/model/mock_models.rb', line 35 def exists?(attrs) end |
.ids ⇒ Object
38 39 |
# File 'lib/lumix/model/mock_models.rb', line 38 def ids end |
.table ⇒ Object
15 16 17 |
# File 'lib/lumix/model/mock_models.rb', line 15 def table @@table ||= [] end |
Instance Method Details
#save ⇒ Object
5 6 7 |
# File 'lib/lumix/model/mock_models.rb', line 5 def save # data aware ;) end |
#save_new ⇒ Object
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 |