Class: NsOptions::NamespaceData::DslMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/ns-options/namespace_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject (readonly)

Returns the value of attribute data.



110
111
112
# File 'lib/ns-options/namespace_data.rb', line 110

def data
  @data
end

#nameObject (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

Returns:



120
# File 'lib/ns-options/namespace_data.rb', line 120

def has_args?; !@args.empty?;               end

#reader?Boolean

Returns:



119
# File 'lib/ns-options/namespace_data.rb', line 119

def reader?;   !self.writer?;               end

#writer?Boolean

Returns:



118
# File 'lib/ns-options/namespace_data.rb', line 118

def writer?;   !!(@method_string =~ /=\Z/); end