Class: AttributedClass::MethodAttribute
- Defined in:
- lib/attributed_class.rb
Constant Summary collapse
- VISIBILITIES =
[ :private, :protected, :public, :unknown ]
Instance Attribute Summary collapse
-
#visibility ⇒ Object
readonly
Returns the value of attribute visibility.
Attributes inherited from Attribute
#default, #default_proc, #descr, #klass, #mandatory, #name
Instance Method Summary collapse
-
#initialize(name, descr, *args) ⇒ MethodAttribute
constructor
A new instance of MethodAttribute.
- #private? ⇒ Boolean
- #protected? ⇒ Boolean
- #public? ⇒ Boolean
Methods inherited from Attribute
#compute_default, #help, #inspect, #invisible?, #mandatory?, set_default_proc, #to_form, #valid?, #visible?
Constructor Details
#initialize(name, descr, *args) ⇒ MethodAttribute
Returns a new instance of MethodAttribute.
153 154 155 156 157 158 |
# File 'lib/attributed_class.rb', line 153 def initialize ( name, descr, *args ) vis = args.find { |arg| VISIBILITIES.include? arg } args.delete(vis) unless vis.nil? @visibility = vis || :unknown super(name, descr, *args) end |
Instance Attribute Details
#visibility ⇒ Object (readonly)
Returns the value of attribute visibility.
143 144 145 |
# File 'lib/attributed_class.rb', line 143 def visibility @visibility end |
Instance Method Details
#private? ⇒ Boolean
144 145 146 |
# File 'lib/attributed_class.rb', line 144 def private? @visibility == :private end |
#protected? ⇒ Boolean
147 148 149 |
# File 'lib/attributed_class.rb', line 147 def protected? @visibility == :protected end |
#public? ⇒ Boolean
150 151 152 |
# File 'lib/attributed_class.rb', line 150 def public? @visibility == :public end |