Module: NattyUI::Frame
- Defined in:
- lib/natty-ui/frame.rb
Overview
Helper class to select frame types.
Class Attribute Summary collapse
-
.default ⇒ Symbol
writeonly
Define frame type used by default.
-
.names ⇒ Array<Symbol>
readonly
Defined frame type names.
Class Method Summary collapse
-
.[](name) ⇒ String
Frame definition.
Class Attribute Details
.default=(value) ⇒ Symbol (writeonly)
Define frame type used by default.
13 14 15 |
# File 'lib/natty-ui/frame.rb', line 13 def self.default=(value) @default = self[value.nil? || value == :default ? :rounded : value] end |
.names ⇒ Array<Symbol> (readonly)
Defined frame type names.
22 |
# File 'lib/natty-ui/frame.rb', line 22 def self.names = @all.keys |
Class Method Details
.[](name) ⇒ String
Returns frame definition.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/natty-ui/frame.rb', line 28 def self.[](name) return @default if name == :default if name.is_a?(Symbol) ret = @all[name] and return ret elsif name.is_a?(String) return name if name.size == 11 return name * 11 if name.size == 1 end raise(ArgumentError, "invalid frame type - #{name}") end |