Class: Marty::Tag
Constant Summary
Constants inherited
from Base
Base::COUNT_SIG, Base::DISTINCT_SIG, Base::FIRST_SIG, Base::GROUP_SIG, Base::JOINS_SIG, Base::LAST_SIG, Base::LIMIT_SIG, Base::MCFLY_PT_SIG, Base::NOT_SIG, Base::ORDER_SIG, Base::PLUCK_SIG, Base::SELECT_SIG, Base::WHERE_SIG
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
mcfly_pt
joins, old_joins
Class Method Details
.do_create(dt, comment) ⇒ Object
26
27
28
29
30
31
32
|
# File 'app/models/marty/tag.rb', line 26
def self.do_create(dt, )
o = new
o. =
o.created_dt = dt
o.save!
o
end
|
.make_name(dt) ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'app/models/marty/tag.rb', line 9
def self.make_name(dt)
return 'DEV' if Mcfly.is_infinity(dt)
dt ||= Time.now
dt.strftime('%Y%m%d-%H%M')
end
|
.map_to_tag(tag_id) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'app/models/marty/tag.rb', line 38
def self.map_to_tag(tag_id)
case tag_id
when Integer, /\A[0-9]+\z/
tag = find_by_id(tag_id)
when String
tag = find_by_name(tag_id)
if !tag
posting = Marty::Posting.lookup(tag_id)
tag = find_match(Mcfly.normalize_infinity(posting.created_dt)) if
posting
end
when nil
tag = get_latest1
else
tag = tag_id
end
raise "bad tag identifier #{tag_id.inspect}" unless tag.is_a? Marty::Tag
tag
end
|
Instance Method Details
#isdev? ⇒ Boolean
34
35
36
|
# File 'app/models/marty/tag.rb', line 34
def isdev?
Mcfly.is_infinity(created_dt)
end
|
#set_tag_name ⇒ Object
21
22
23
24
|
# File 'app/models/marty/tag.rb', line 21
def set_tag_name
self.name = self.class.make_name(self.created_dt)
true
end
|