Class: NsOptions::NamespaceData::DslMethod
- Inherits:
-
Object
- Object
- NsOptions::NamespaceData::DslMethod
- Defined in:
- lib/ns-options/namespace_data.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #has_args? ⇒ Boolean
-
#initialize(meth, *args, &block) ⇒ DslMethod
constructor
A new instance of DslMethod.
- #reader? ⇒ Boolean
- #writer? ⇒ Boolean
Constructor Details
#initialize(meth, *args, &block) ⇒ DslMethod
Returns a new instance of DslMethod.
112 113 114 115 116 |
# File 'lib/ns-options/namespace_data.rb', line 112 def initialize(meth, *args, &block) @method_string, @args, @block = meth.to_s, args, block @name = @method_string.gsub("=", "") @data = args.size == 1 ? args[0] : args end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
110 111 112 |
# File 'lib/ns-options/namespace_data.rb', line 110 def data @data end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
110 111 112 |
# File 'lib/ns-options/namespace_data.rb', line 110 def name @name end |
Instance Method Details
#has_args? ⇒ Boolean
120 |
# File 'lib/ns-options/namespace_data.rb', line 120 def has_args?; !@args.empty?; end |
#reader? ⇒ Boolean
119 |
# File 'lib/ns-options/namespace_data.rb', line 119 def reader?; !self.writer?; end |
#writer? ⇒ Boolean
118 |
# File 'lib/ns-options/namespace_data.rb', line 118 def writer?; !!(@method_string =~ /=\Z/); end |