Sha256: 026af656ed6a93d07a495c23a2027ab449b4ab5537c8c2962c24d4012c4bc729
Contents?: true
Size: 881 Bytes
Versions: 2
Compression:
Stored size: 881 Bytes
Contents
# encoding: utf-8 require "dslable_args" module Dslable class Field attr_accessor :_field_name attr_accessor :_desc attr_accessor :_args def initialize @_desc = "" end def field_name(_name) return if _name.nil? @_field_name = _name end def desc(_desc) return if _desc.nil? @_desc = _desc end 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 end class InvalidFieldError < StandardError;end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dslable-0.0.2 | lib/dslable_field.rb |
dslable-0.0.1 | lib/dslable_field.rb |