Class: CommandMapper::Gen::Types::Str
- Inherits:
-
Object
- Object
- CommandMapper::Gen::Types::Str
- Defined in:
- lib/command_mapper/gen/types/str.rb
Instance Attribute Summary collapse
-
#allow_blank ⇒ Boolean?
readonly
The
allow_blank
keyword. -
#allow_empty ⇒ Boolean?
readonly
The
allow_empty
keyword.
Instance Method Summary collapse
-
#initialize(allow_empty: nil, allow_blank: nil) ⇒ Str
constructor
Initializes the value type.
-
#to_ruby ⇒ String?
Converts the value type to Ruby source code.
Constructor Details
#initialize(allow_empty: nil, allow_blank: nil) ⇒ Str
Initializes the value type.
25 26 27 28 |
# File 'lib/command_mapper/gen/types/str.rb', line 25 def initialize(allow_empty: nil, allow_blank: nil) @allow_empty = allow_empty @allow_blank = allow_blank end |
Instance Attribute Details
#allow_blank ⇒ Boolean? (readonly)
The allow_blank
keyword.
14 15 16 |
# File 'lib/command_mapper/gen/types/str.rb', line 14 def allow_blank @allow_blank end |
#allow_empty ⇒ Boolean? (readonly)
The allow_empty
keyword.
9 10 11 |
# File 'lib/command_mapper/gen/types/str.rb', line 9 def allow_empty @allow_empty end |
Instance Method Details
#to_ruby ⇒ String?
Converts the value type to Ruby source code.
35 36 37 38 39 40 41 42 43 |
# File 'lib/command_mapper/gen/types/str.rb', line 35 def to_ruby unless (@allow_empty.nil? && @allow_blank.nil?) keywords = [] keywords << "allow_empty: #{@allow_empty.inspect}" unless @allow_empty.nil? keywords << "allow_blank: #{@allow_blank.inspect}" unless @allow_blank.nil? keywords.join(', ') end end |