Class: Dslable::Field
- Inherits:
-
Object
- Object
- Dslable::Field
- Defined in:
- lib/dslable_field.rb
Instance Attribute Summary collapse
-
#_args ⇒ Object
Returns the value of attribute _args.
-
#_desc ⇒ Object
Returns the value of attribute _desc.
-
#_field_name ⇒ Object
Returns the value of attribute _field_name.
Instance Method Summary collapse
- #args(args_name) {|dslable_args| ... } ⇒ Object
- #desc(_desc) ⇒ Object
- #field_name(_name) ⇒ Object
-
#initialize ⇒ Field
constructor
A new instance of Field.
Constructor Details
#initialize ⇒ Field
Returns a new instance of Field.
10 11 12 |
# File 'lib/dslable_field.rb', line 10 def initialize @_desc = "" end |
Instance Attribute Details
#_args ⇒ Object
Returns the value of attribute _args.
8 9 10 |
# File 'lib/dslable_field.rb', line 8 def _args @_args end |
#_desc ⇒ Object
Returns the value of attribute _desc.
7 8 9 |
# File 'lib/dslable_field.rb', line 7 def _desc @_desc end |
#_field_name ⇒ Object
Returns the value of attribute _field_name.
6 7 8 |
# File 'lib/dslable_field.rb', line 6 def _field_name @_field_name end |
Instance Method Details
#args(args_name) {|dslable_args| ... } ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/dslable_field.rb', line 24 def args(args_name) raise InvalidFieldError.new("args_name not allow nil") if args_name.nil? raise InvalidFieldError.new("args_name not allow empty") if args_name.empty? raise InvalidFieldError.new("args_name allow /^[a-z0-9_]+$/. your input is #{args_name}") unless args_name =~ /^[a-z0-9_]+$/ dslable_args = Dslable::Args.new dslable_args._args_name = args_name yield dslable_args @_args = dslable_args end |
#desc(_desc) ⇒ Object
19 20 21 22 |
# File 'lib/dslable_field.rb', line 19 def desc(_desc) return if _desc.nil? @_desc = _desc end |
#field_name(_name) ⇒ Object
14 15 16 17 |
# File 'lib/dslable_field.rb', line 14 def field_name(_name) return if _name.nil? @_field_name = _name end |