Class: XDry::NFieldDef

Inherits:
Node
  • Object
show all
Defined in:
lib/xdry/parsing/nodes.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#indent, #pos

Instance Method Summary collapse

Methods inherited from Node

#method_missing, #tagged_with?, #tags, #tags=, #tags_comment

Constructor Details

#initialize(name, type) ⇒ NFieldDef

Returns a new instance of NFieldDef.



44
45
46
47
# File 'lib/xdry/parsing/nodes.rb', line 44

def initialize name, type
  super()
  @name, @type = name, type
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class XDry::Node

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



42
43
44
# File 'lib/xdry/parsing/nodes.rb', line 42

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



42
43
44
# File 'lib/xdry/parsing/nodes.rb', line 42

def type
  @type
end

Instance Method Details

#persistent?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/xdry/parsing/nodes.rb', line 49

def persistent?
  tagged_with? 'persistent'
end

#to_sObject



61
62
63
# File 'lib/xdry/parsing/nodes.rb', line 61

def to_s
  "#{@type} #{@name}#{tags_comment}"
end

#to_sourceObject



65
66
67
# File 'lib/xdry/parsing/nodes.rb', line 65

def to_source
  "#{@type.to_source_with_space}#{@name};"
end

#wants_constructor?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/xdry/parsing/nodes.rb', line 57

def wants_constructor?
  tagged_with? 'wants-constructor'
end

#wants_property?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/xdry/parsing/nodes.rb', line 53

def wants_property?
  tagged_with? 'wants-property'
end