Class: TypecastedOpenStruct::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/typecasted_open_struct.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, attr_type = String, options = {}) ⇒ Element

Returns a new instance of Element.



71
72
73
74
75
# File 'lib/typecasted_open_struct.rb', line 71

def initialize(name, attr_type=String, options={})
  self.name = name.to_s
  self.attr_type = attr_type
  self.options = options
end

Instance Attribute Details

#attr_typeObject

Returns the value of attribute attr_type.



69
70
71
# File 'lib/typecasted_open_struct.rb', line 69

def attr_type
  @attr_type
end

#nameObject

Returns the value of attribute name.



69
70
71
# File 'lib/typecasted_open_struct.rb', line 69

def name
  @name
end

#namespaceObject

Returns the value of attribute namespace.



69
70
71
# File 'lib/typecasted_open_struct.rb', line 69

def namespace
  @namespace
end

#optionsObject

Returns the value of attribute options.



69
70
71
# File 'lib/typecasted_open_struct.rb', line 69

def options
  @options
end

Instance Method Details

#method_nameObject



77
78
79
# File 'lib/typecasted_open_struct.rb', line 77

def method_name
  @method_name ||= name.tr('-', '_')
end