Class: Aio::Module::Description
- Inherits:
-
Object
- Object
- Aio::Module::Description
- Defined in:
- lib/aio/core/module/description.rb
Direct Known Subclasses
CRC, InputErrors, Overrun, ProcRatio, Protocol, Register, Runts, Temp, TotalOutputDrops
Defined Under Namespace
Classes: CRC, InputErrors, Overrun, ProcRatio, Protocol, Register, Runts, Temp, TotalOutputDrops
Instance Attribute Summary collapse
-
#description_info ⇒ Object
Returns the value of attribute description_info.
Instance Method Summary collapse
- #author ⇒ Object
- #case ⇒ Object
-
#clear ⇒ Object
清楚基本信息.
- #description ⇒ Object
-
#initialize(info = {}) ⇒ Description
constructor
A new instance of Description.
- #license ⇒ Object
- #name ⇒ Object
-
#parent? ⇒ Boolean
判断是否是 Description 父类.
- #set_defaults ⇒ Object
-
#temp(cs) ⇒ Object
创建临时信息,用于在没有描述类的时候使用.
- #title ⇒ Object
-
#to_s ⇒ Object
重载方法.
- #type ⇒ Object
Constructor Details
#initialize(info = {}) ⇒ Description
Returns a new instance of Description.
8 9 10 11 |
# File 'lib/aio/core/module/description.rb', line 8 def initialize(info={}) @description_info = info.dup set_defaults() end |
Instance Attribute Details
#description_info ⇒ Object
Returns the value of attribute description_info.
6 7 8 |
# File 'lib/aio/core/module/description.rb', line 6 def description_info @description_info end |
Instance Method Details
#author ⇒ Object
59 |
# File 'lib/aio/core/module/description.rb', line 59 def ; description_info[:author]; end |
#case ⇒ Object
60 |
# File 'lib/aio/core/module/description.rb', line 60 def case; description_info[:case]; end |
#clear ⇒ Object
清楚基本信息
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/aio/core/module/description.rb', line 48 def clear self.description_info = { :author => nil, :case => nil, :name => nil, :title => nil, :description => nil, :license => ::Aio::AIO_LICENSE, } end |
#description ⇒ Object
63 |
# File 'lib/aio/core/module/description.rb', line 63 def description; description_info[:description]; end |
#license ⇒ Object
64 |
# File 'lib/aio/core/module/description.rb', line 64 def license; description_info[:license]; end |
#name ⇒ Object
61 |
# File 'lib/aio/core/module/description.rb', line 61 def name; description_info[:name]; end |
#parent? ⇒ Boolean
判断是否是 Description 父类
34 35 36 |
# File 'lib/aio/core/module/description.rb', line 34 def parent? self.class == type ? true : false end |
#set_defaults ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/aio/core/module/description.rb', line 13 def set_defaults self.description_info = { :author => nil, :case => nil, :name => nil, :title => nil, :description => nil, :license => ::Aio::AIO_LICENSE, }.update(@description_info) end |
#temp(cs) ⇒ Object
创建临时信息,用于在没有描述类的时候使用
39 40 41 42 43 44 45 |
# File 'lib/aio/core/module/description.rb', line 39 def temp(cs) clear @description_info[:case] = cs @description_info[:name] = cs.to_s.upcase @description_info[:title] = cs.to_s.upcase + "检查" self end |
#title ⇒ Object
62 |
# File 'lib/aio/core/module/description.rb', line 62 def title; description_info[:title]; end |
#to_s ⇒ Object
重载方法
29 30 31 |
# File 'lib/aio/core/module/description.rb', line 29 def to_s "暂无描述信息。" end |
#type ⇒ Object
24 25 26 |
# File 'lib/aio/core/module/description.rb', line 24 def type Aio::Module::Description end |