class SixSaferpay::Generators::Attribute
Attributes
mandatory[RW]
name[RW]
type[RW]
Public Class Methods
new(name, type, mandatory = false)
click to toggle source
# File lib/generators/models.rb, line 61 def initialize(name, type, mandatory = false) @name = name @type = type if mandatory == "true" @mandatory = true elsif mandatory == "false" @mandatory = false else @mandatory = mandatory end end
Public Instance Methods
boolean?()
click to toggle source
# File lib/generators/models.rb, line 81 def boolean? @type.downcase == "boolean" end
mandatory?()
click to toggle source
# File lib/generators/models.rb, line 73 def mandatory? @mandatory end
string?()
click to toggle source
# File lib/generators/models.rb, line 77 def string? @type.downcase == "string" end
to_h()
click to toggle source
# File lib/generators/models.rb, line 89 def to_h hash = Hash.new hash.merge!(name: name) hash.merge!(type: type) hash.merge!(mandatory: mandatory) hash end
to_s()
click to toggle source
# File lib/generators/models.rb, line 85 def to_s to_h end