class MiniResource
Public Class Methods
new(row, sheet)
click to toggle source
# File lib/sawa/MiniResource.rb, line 2 def initialize(row, sheet) @row = row @sheet = sheet @idx_method = 1 @idx_process = 2 @idx_role = 3 @idx_desc = 4 @idx_islist = 5 @idx_param = 6 @idx_path = 7 @idx_httpM = 8 end
Public Instance Methods
resource_desc()
click to toggle source
# File lib/sawa/MiniResource.rb, line 31 def resource_desc @row[@idx_desc] end
resource_httpM()
click to toggle source
# File lib/sawa/MiniResource.rb, line 96 def resource_httpM @row[@idx_httpM] end
resource_islist()
click to toggle source
# File lib/sawa/MiniResource.rb, line 35 def resource_islist @row[@idx_islist] == "1" end
resource_method()
click to toggle source
# File lib/sawa/MiniResource.rb, line 15 def resource_method @row[@idx_method] end
resource_param_full()
click to toggle source
# File lib/sawa/MiniResource.rb, line 69 def resource_param_full vals = [] prms = @row[@idx_param].split(",") prms.map do |prm| if prm.strip == "@query" vals.push("MiniQuery query") elsif prm.strip == "@role" vals.push("@Auth OperatorRole role") elsif prm.strip == "@obj" vals.push("#{@sheet.model_name} obj") else arr = prm.split(" ") s = arr[arr.length - 1] if @row[@idx_path].include?("#{s}") vals.push("@PathParam(\"#{s}\") #{prm.strip}") else vals.push("@QueryParam(\"#{s}\") #{prm.strip}") end end end vals.join(",") end
resource_param_type()
click to toggle source
# File lib/sawa/MiniResource.rb, line 39 def resource_param_type vals = [] prms = @row[@idx_param].split(",") prms.map do |prm| if prm.strip == "@query" vals.push("MiniQuery query") elsif prm.strip == "@role" vals.push("OperatorRole role") elsif prm.strip == "@obj" vals.push("#{@sheet.model_name} obj") else vals.push(prm) end end vals.join(",") end
resource_param_value()
click to toggle source
# File lib/sawa/MiniResource.rb, line 56 def resource_param_value vals = [] prms = @row[@idx_param].split(",") prms.map do |prm| tmp = prm.split(" ") vals.push(tmp[tmp.length - 1].gsub(/@/, '')) end if !@row[@idx_process].start_with?("super.") vals.push("this") end vals.join(",") end
resource_path()
click to toggle source
# File lib/sawa/MiniResource.rb, line 92 def resource_path @row[@idx_path] end
resource_process()
click to toggle source
# File lib/sawa/MiniResource.rb, line 19 def resource_process @row[@idx_process] end
resource_role()
click to toggle source
# File lib/sawa/MiniResource.rb, line 23 def resource_role if @row[@idx_role] == nil or @row[@idx_role] == "" nil else "\"" + @row[@idx_role].split(",").join(",") + "\"" end end